Skip to content

Commit 1289f78

Browse files
committed
ComponentClip groupVisible fix, destroy method added.
1 parent fdc767c commit 1289f78

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/clip/ComponentClip.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ export default class ComponentClip {
175175
}
176176

177177
set groupX(val) {
178-
//debugger;
179178
if (this._groupConfig.x === val) {
180179
return;
181180
}
@@ -245,7 +244,7 @@ export default class ComponentClip {
245244
return;
246245
}
247246
this._groupConfig.visible = val;
248-
this.visible &= val;
247+
this._stateManager.setupState();
249248
}
250249

251250

@@ -407,6 +406,17 @@ export default class ComponentClip {
407406
return this._stateManager.getActiveComponentByKey(key);
408407
}
409408

409+
/**
410+
* @public
411+
* @method PhaserComps.ComponentClip#destroy
412+
* @description destroy all child GameObjects and child clips recursively
413+
*/
414+
destroy() {
415+
_.each(this.childrenList, child => {
416+
child.destroy();
417+
}, this);
418+
}
419+
410420
/**
411421
* @method PhaserComps.ComponentClip#_createImagesMap
412422
* @description
@@ -789,7 +799,7 @@ class StateManager {
789799
}
790800
this._currentStateId = stateId;
791801
this._currentState = this._states[stateId];
792-
this._setupState();
802+
this.setupState();
793803
}
794804

795805
/**
@@ -816,10 +826,10 @@ class StateManager {
816826

817827
/**
818828
* Show state components, apply its' state positions, and hide non-state components
819-
* @method PhaserComps.ComponentClip.tateManager#_setupState
820-
* @private
829+
* @method PhaserComps.ComponentClip.tateManager#setupState
830+
* @protected
821831
*/
822-
_setupState() {
832+
setupState() {
823833
let idsToShow = this._currentState.componentIds;
824834
let idsToHide = _.difference(this._dynamicChildrenIds, idsToShow);
825835

0 commit comments

Comments
 (0)