PIXI Controls: Fix Interval cleaning
This commit is contained in:
parent
e396132f7f
commit
e74e407aed
1 changed files with 4 additions and 5 deletions
|
@ -268,13 +268,12 @@ ONSControls.updateButtons = function() {
|
||||||
ONSControls.setupInteractive = function () {
|
ONSControls.setupInteractive = function () {
|
||||||
|
|
||||||
// Canvas
|
// Canvas
|
||||||
var idleInterval = setInterval(ONSControls.playIdleAnimation, 60000);
|
this._idleInterval = setInterval(ONSControls.playIdleAnimation, 60000);
|
||||||
this._controlsCanvas.stage.on("pointerdown", () => {
|
this._controlsCanvas.stage.on("pointerdown", () => {
|
||||||
this.stopIdleAnimation();
|
this.stopIdleAnimation();
|
||||||
clearInterval(idleInterval);
|
clearInterval(ONSControls._idleInterval);
|
||||||
idleInterval = setInterval(ONSControls.playIdleAnimation, 60000);
|
ONSControls._idleInterval = setInterval(ONSControls.playIdleAnimation, 60000);
|
||||||
});
|
});
|
||||||
this._idleInterval = idleInterval;
|
|
||||||
|
|
||||||
// A/B/X/Y
|
// A/B/X/Y
|
||||||
const buttons = this._buttonsContainer.children;
|
const buttons = this._buttonsContainer.children;
|
||||||
|
@ -335,6 +334,7 @@ ONSControls.clearInteractive = function() {
|
||||||
elem.removeAllListeners();
|
elem.removeAllListeners();
|
||||||
}
|
}
|
||||||
this._dPadContainer.upAll();
|
this._dPadContainer.upAll();
|
||||||
|
clearInterval(this._idleInterval);
|
||||||
// Clear status of VirtualGamepad
|
// Clear status of VirtualGamepad
|
||||||
VirtualGamepad.clearState();
|
VirtualGamepad.clearState();
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,6 @@ ONSControls.openEditMode = function() {
|
||||||
if (Graphics._canvas.hidden === false) {
|
if (Graphics._canvas.hidden === false) {
|
||||||
Graphics._canvas.hidden = true;
|
Graphics._canvas.hidden = true;
|
||||||
this.clearInteractive();
|
this.clearInteractive();
|
||||||
clearInterval(this._idleInterval);
|
|
||||||
this._buttonsContainer.interactive = true;
|
this._buttonsContainer.interactive = true;
|
||||||
for (elem of this.getControlElements()) {
|
for (elem of this.getControlElements()) {
|
||||||
this.setupDragNDrop(elem);
|
this.setupDragNDrop(elem);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue