PIXI Controls: Move buttons container instead of buttons

This commit is contained in:
OleSTEEP 2024-02-15 00:50:30 +03:00
parent dc4bb1389a
commit b68bf9c002

View file

@ -129,7 +129,7 @@ ONSControls.createEditModeInterface = function() {
fill: 0xaaaaaa,
align: 'center'
});
const tipText = new PIXI.Text("Здась вы можете свободно перемещать элементы управления по экрану.\nЧтобы выйти из этого режима, нажмите кнопку \"Назад\" вашего Android устройства.", {
const tipText = new PIXI.Text("Здесь вы можете свободно перемещать элементы управления по экрану.\nЧтобы выйти из этого режима, нажмите кнопку \"Назад\" вашего Android устройства.", {
fontFamily: 'Arial',
fontSize: 16,
fill: 0xaaaaaa,
@ -320,9 +320,7 @@ ONSControls.setupInteractive = function () {
ONSControls.getControlElements = function() {
return [
this._dPadContainer, this._LBsprite,
this._RBsprite, this._showButton, this._buttonsContainer.children[0],
this._buttonsContainer.children[1], this._buttonsContainer.children[2],
this._buttonsContainer.children[3]
this._RBsprite, this._showButton, this._buttonsContainer
];
}
//=============================================================================
@ -330,6 +328,9 @@ ONSControls.getControlElements = function() {
//=============================================================================
ONSControls.clearInteractive = function() {
this._controlsCanvas.stage.removeAllListeners();
for (child of this._buttonsContainer.children) {
child.removeAllListeners();
}
for (elem of this.getControlElements()) {
elem.removeAllListeners();
}
@ -381,6 +382,7 @@ ONSControls.openEditMode = function() {
Graphics._canvas.hidden = true;
this.clearInteractive();
clearInterval(this._idleInterval);
this._buttonsContainer.interactive = true;
for (elem of this.getControlElements()) {
this.setupDragNDrop(elem);
}