@@ -5,7 +5,6 @@ var THREE = require('../lib/three');
55var utils = require ( '../utils/' ) ;
66
77var AEntity ;
8- var bind = utils . bind ;
98var debug = utils . debug ( 'core:a-entity:debug' ) ;
109var warn = utils . debug ( 'core:a-entity:warn' ) ;
1110
@@ -131,62 +130,6 @@ var proto = Object.create(ANode.prototype, {
131130 }
132131 } ,
133132
134- /**
135- * Add new mixin for each mixin with state suffix.
136- */
137- mapStateMixins : {
138- value : function ( state , op ) {
139- var mixins ;
140- var mixinIds ;
141- var i ;
142-
143- mixins = this . getAttribute ( 'mixin' ) ;
144-
145- if ( ! mixins ) { return ; }
146- mixinIds = mixins . split ( ' ' ) ;
147- for ( i = 0 ; i < mixinIds . length ; i ++ ) {
148- op ( mixinIds [ i ] + '-' + state ) ;
149- }
150- this . updateComponents ( ) ;
151- }
152- } ,
153-
154- /**
155- * Handle update of mixin states (e.g., `box-hovered` where `box` is the mixin ID and
156- * `hovered` is the entity state.
157- */
158- updateStateMixins : {
159- value : function ( newMixins , oldMixins ) {
160- var diff ;
161- var newMixinIds ;
162- var oldMixinIds ;
163- var i ;
164- var j ;
165- var stateMixinEls ;
166-
167- newMixinIds = newMixins . split ( ' ' ) ;
168- oldMixinIds = ( oldMixins || '' ) ? oldMixins . split ( ' ' ) : [ ] ;
169-
170- // List of mixins that might have been removed on update.
171- diff = oldMixinIds . filter ( function ( i ) { return newMixinIds . indexOf ( i ) < 0 ; } ) ;
172-
173- // Remove removed mixins.
174- for ( i = 0 ; i < diff . length ; i ++ ) {
175- stateMixinEls = document . querySelectorAll ( '[id^=' + diff [ i ] + '-]' ) ;
176- for ( j = 0 ; j < stateMixinEls . length ; j ++ ) {
177- this . unregisterMixin ( stateMixinEls [ j ] . id ) ;
178- }
179- }
180-
181- // Add new mixins.
182- for ( i = 0 ; i < this . states . length ; i ++ ) {
183- for ( j = 0 ; j < newMixinIds . length ; j ++ ) {
184- this . registerMixin ( newMixinIds [ j ] + '-' + this . states [ i ] ) ;
185- }
186- }
187- }
188- } ,
189-
190133 getObject3D : {
191134 value : function ( type ) {
192135 return this . object3DMap [ type ] ;
@@ -668,7 +611,6 @@ var proto = Object.create(ANode.prototype, {
668611 value : function ( newMixins , oldMixins ) {
669612 oldMixins = oldMixins || this . getAttribute ( 'mixin' ) ;
670613 this . updateMixins ( newMixins , oldMixins ) ;
671- this . updateStateMixins ( newMixins , oldMixins ) ;
672614 this . updateComponents ( ) ;
673615 }
674616 } ,
@@ -823,8 +765,7 @@ var proto = Object.create(ANode.prototype, {
823765 value : function ( state ) {
824766 if ( this . is ( state ) ) { return ; }
825767 this . states . push ( state ) ;
826- this . mapStateMixins ( state , bind ( this . registerMixin , this ) ) ;
827- this . emit ( 'stateadded' , { state : state } ) ;
768+ this . emit ( 'stateadded' , state ) ;
828769 }
829770 } ,
830771
@@ -833,8 +774,7 @@ var proto = Object.create(ANode.prototype, {
833774 var stateIndex = this . states . indexOf ( state ) ;
834775 if ( stateIndex === - 1 ) { return ; }
835776 this . states . splice ( stateIndex , 1 ) ;
836- this . mapStateMixins ( state , bind ( this . unregisterMixin , this ) ) ;
837- this . emit ( 'stateremoved' , { state : state } ) ;
777+ this . emit ( 'stateremoved' , state ) ;
838778 }
839779 } ,
840780
0 commit comments