PIXI Controls: Disable elements pressing while moving another element
This commit is contained in:
parent
322a754bf6
commit
e396132f7f
1 changed files with 23 additions and 18 deletions
|
@ -341,13 +341,17 @@ ONSControls.clearInteractive = function() {
|
|||
//=============================================================================
|
||||
// * Setup drag'n drop events for element
|
||||
//=============================================================================
|
||||
ONSControls.editButtonBressed = false;
|
||||
ONSControls.setupDragNDrop = function(element) {
|
||||
var orig_alpha = element.alpha;
|
||||
element.cursor = "pointer";
|
||||
|
||||
var onStart = function(event) {
|
||||
element.alpha = orig_alpha / 2;
|
||||
ONSControls._controlsCanvas.stage.on("pointermove", onMove);
|
||||
if (ONSControls.editButtonBressed === false) {
|
||||
ONSControls.editButtonBressed = true;
|
||||
element.alpha = orig_alpha / 2;
|
||||
ONSControls._controlsCanvas.stage.on("pointermove", onMove);
|
||||
}
|
||||
}
|
||||
var onMove = function(event) {
|
||||
if (element) {
|
||||
|
@ -358,6 +362,7 @@ ONSControls.setupDragNDrop = function(element) {
|
|||
var onEnd = function(event) {
|
||||
if (element) {
|
||||
ONSControls._controlsCanvas.stage.off("pointermove", onMove);
|
||||
ONSControls.editButtonBressed = false;
|
||||
element.alpha = orig_alpha;
|
||||
};
|
||||
}
|
||||
|
@ -381,21 +386,6 @@ ONSControls.replaceBackEvent = function() {
|
|||
});
|
||||
}
|
||||
//=============================================================================
|
||||
// * Save buttons position to config
|
||||
//=============================================================================
|
||||
ONSControls.saveButtonsPosition = function() {
|
||||
ConfigManager.ONSConfig.buttonsX = this._buttonsContainer.x;
|
||||
ConfigManager.ONSConfig.buttonsY = this._buttonsContainer.y;
|
||||
ConfigManager.ONSConfig.dPadX = this._dPadContainer.x;
|
||||
ConfigManager.ONSConfig.dPadY = this._dPadContainer.y;
|
||||
ConfigManager.ONSConfig.LBX = this._LBsprite.x;
|
||||
ConfigManager.ONSConfig.LBY = this._LBsprite.y;
|
||||
ConfigManager.ONSConfig.RBX = this._RBsprite.x;
|
||||
ConfigManager.ONSConfig.RBY = this._RBsprite.y;
|
||||
ConfigManager.ONSConfig.showX = this._showButton.x;
|
||||
ConfigManager.ONSConfig.showY = this._showButton.y;
|
||||
}
|
||||
//=============================================================================
|
||||
// * Open Edit Mode
|
||||
//=============================================================================
|
||||
ONSControls.openEditMode = function() {
|
||||
|
@ -420,7 +410,7 @@ ONSControls.closeEditMode = function() {
|
|||
Graphics._canvas.hidden = false;
|
||||
this.clearInteractive();
|
||||
this.setupInteractive();
|
||||
this.saveButtonsPosition();
|
||||
ConfigManager.ONSConfig.saveButtonsPosition();
|
||||
}
|
||||
|
||||
|
||||
|
@ -593,6 +583,21 @@ ConfigManager.restoreDefaultConfig = function () {
|
|||
if (!!needsRestore) { DataManager._restoreGlobalInfo(); }
|
||||
}
|
||||
//=============================================================================
|
||||
// * Save buttons position to config
|
||||
//=============================================================================
|
||||
ConfigManager.ONSConfig.saveButtonsPosition = function() {
|
||||
this.buttonsX = ONSControls._buttonsContainer.x;
|
||||
this.buttonsY = ONSControls._buttonsContainer.y;
|
||||
this.dPadX = ONSControls._dPadContainer.x;
|
||||
this.dPadY = ONSControls._dPadContainer.y;
|
||||
this.LBX = ONSControls._LBsprite.x;
|
||||
this.LBY = ONSControls._LBsprite.y;
|
||||
this.RBX = ONSControls._RBsprite.x;
|
||||
this.RBY = ONSControls._RBsprite.y;
|
||||
this.showX = ONSControls._showButton.x;
|
||||
this.showY = ONSControls._showButton.y;
|
||||
}
|
||||
//=============================================================================
|
||||
// * Update all controls data
|
||||
//=============================================================================
|
||||
ConfigManager.ONSConfig.updateData = function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue