From c1625397fc85d1ce7bb7868ceb615cb9fd84559a Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Mon, 19 Feb 2024 22:08:11 +0300 Subject: [PATCH] PIXI Conrols: Fix A/B/X/Y buttons hitArea in edit mode --- www.rus/js/plugins/VND_ONSControls.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/www.rus/js/plugins/VND_ONSControls.js b/www.rus/js/plugins/VND_ONSControls.js index 95a3099..e298eb1 100644 --- a/www.rus/js/plugins/VND_ONSControls.js +++ b/www.rus/js/plugins/VND_ONSControls.js @@ -55,7 +55,6 @@ ONSControls.createDPad = function() { const container = new PIXI.Sprite.fromImage("js/porting/assets/omori_dpad.png"); container.anchor.set(0.5); container.interactive = true; - container.cursor = "pointer"; container.pressed = false; container.pressed_button = null; container.down = function(x, y) { @@ -311,6 +310,9 @@ ONSControls.setupInteractive = function () { .on("pointerup", (event) => {this.sendEvent(event, "BUTTON_B")}); buttons[3].on("pointerdown", (event) => {this.sendEvent(event, "BUTTON_Y")}) .on("pointerup", (event) => {this.sendEvent(event, "BUTTON_Y")}); + for (btn of buttons) { + btn.hitArea = new PIXI.Circle(0, 0, 40); + } // DPAD const container = this._dPadContainer; @@ -373,7 +375,6 @@ ONSControls.clearInteractive = function() { ONSControls.editButtonBressed = false; ONSControls.setupDragNDrop = function(element) { var orig_alpha = element.alpha; - element.cursor = "pointer"; var onStart = function(event) { if (ONSControls.editButtonBressed === false) { @@ -426,6 +427,7 @@ ONSControls.openEditMode = function() { for (elem of this.getControlElements()) { this.setupDragNDrop(elem); } + this._buttonsContainer.children[0].hitArea = new PIXI.Circle(0, -50, 100); this._editModeText.visible = true; this._editModeText.x = this._controlsCanvas.screen.width / 2; this._editModeText.y = this._controlsCanvas.screen.height / 2;