PIXI Conrols: Fix A/B/X/Y buttons hitArea in edit mode

This commit is contained in:
OleSTEEP 2024-02-19 22:08:11 +03:00
parent e6f31a5e4f
commit c1625397fc

View file

@ -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;