فهرست منبع

fix(extend): fix extend about EventDispatcher

adjust sub-class extend EventDispatcher, not copy EventDispatcher’s
prototype
jason chen 7 سال پیش
والد
کامیت
4ef93bdb3b

+ 3 - 1
src/animation/AnimationMixer.js

@@ -27,7 +27,9 @@ function AnimationMixer( root ) {
 
 
 }
 }
 
 
-Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
+AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+	
+	constructor: AnimationMixer,
 
 
 	_bindAction: function ( action, prototypeAction ) {
 	_bindAction: function ( action, prototypeAction ) {
 
 

+ 3 - 1
src/core/BufferGeometry.js

@@ -40,7 +40,9 @@ function BufferGeometry() {
 
 
 }
 }
 
 
-Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
+BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+	
+	constructor: BufferGeometry,
 
 
 	isBufferGeometry: true,
 	isBufferGeometry: true,
 
 

+ 3 - 1
src/core/Geometry.js

@@ -58,7 +58,9 @@ function Geometry() {
 
 
 }
 }
 
 
-Object.assign( Geometry.prototype, EventDispatcher.prototype, {
+Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+	
+	constructor: Geometry,
 
 
 	isGeometry: true,
 	isGeometry: true,
 
 

+ 3 - 1
src/core/Object3D.js

@@ -98,7 +98,9 @@ function Object3D() {
 Object3D.DefaultUp = new Vector3( 0, 1, 0 );
 Object3D.DefaultUp = new Vector3( 0, 1, 0 );
 Object3D.DefaultMatrixAutoUpdate = true;
 Object3D.DefaultMatrixAutoUpdate = true;
 
 
-Object.assign( Object3D.prototype, EventDispatcher.prototype, {
+Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+	
+	constructor: Object3D,
 
 
 	isObject3D: true,
 	isObject3D: true,
 
 

+ 3 - 1
src/materials/Material.js

@@ -67,7 +67,9 @@ function Material() {
 
 
 }
 }
 
 
-Object.assign( Material.prototype, EventDispatcher.prototype, {
+Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+	
+	constructor: Material,
 
 
 	isMaterial: true,
 	isMaterial: true,
 
 

+ 3 - 1
src/renderers/WebGLRenderTarget.js

@@ -39,7 +39,9 @@ function WebGLRenderTarget( width, height, options ) {
 
 
 }
 }
 
 
-Object.assign( WebGLRenderTarget.prototype, EventDispatcher.prototype, {
+WebGLRenderTarget.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+	
+	constructor: WebGLRenderTarget,
 
 
 	isWebGLRenderTarget: true,
 	isWebGLRenderTarget: true,
 
 

+ 1 - 1
src/textures/Texture.js

@@ -74,7 +74,7 @@ Object.defineProperty( Texture.prototype, "needsUpdate", {
 
 
 } );
 } );
 
 
-Object.assign( Texture.prototype, EventDispatcher.prototype, {
+Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
 
 
 	constructor: Texture,
 	constructor: Texture,