Skip to content

Commit

Permalink
Fix hit-area bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rexrainbow committed Dec 11, 2024
1 parent 06cc318 commit 830543f
Show file tree
Hide file tree
Showing 34 changed files with 137 additions and 52 deletions.
9 changes: 7 additions & 2 deletions dist/rexbbcodetext.js
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -2444,7 +2449,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexbbcodetext.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexbbcodetextplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -2444,7 +2449,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexbbcodetextplugin.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexcolorcomponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -26224,7 +26224,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -26246,7 +26251,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexcolorcomponents.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexcolorinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -29893,7 +29893,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -29915,7 +29920,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexcolorinput.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexconfirmdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -30313,7 +30313,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -30335,7 +30340,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexconfirmdialog.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexgameobjectshellplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30649,7 +30649,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent$1.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -30671,7 +30676,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexgameobjectshellplugin.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexmdscenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -52754,7 +52754,12 @@ void main () {
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent$1.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -52776,7 +52781,7 @@ void main () {
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexmdscenario.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexmdscenarioplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -52833,7 +52833,12 @@ void main () {
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent$1.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -52855,7 +52860,7 @@ void main () {
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexmdscenarioplugin.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexnameinputdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -30429,7 +30429,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -30451,7 +30456,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexnameinputdialog.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexsimpledropdownlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -33693,7 +33693,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -33715,7 +33720,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexsimpledropdownlist.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexsimplelabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26224,7 +26224,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -26246,7 +26251,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexsimplelabel.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rextagtext.js
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -2444,7 +2449,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rextagtext.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rextagtextplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -2444,7 +2449,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rextagtextplugin.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rextrees.js
Original file line number Diff line number Diff line change
Expand Up @@ -26723,7 +26723,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -26745,7 +26750,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rextrees.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rextweaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27313,7 +27313,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent$1.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -27335,7 +27340,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rextweaker.min.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/rexuiplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6295,7 +6295,12 @@
if (localX === null) { // Case of pointerout
if (this.lastHitAreaKey !== null) {
FireEvent$2.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event);
this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown = false;

var area = this.hitAreaManager.getByKey(this.lastHitAreaKey);
if (area && area.data) {
area.data.isDown = false;
}

this.lastHitAreaKey = null;
}
return;
Expand All @@ -6317,7 +6322,7 @@
SetCursorStyle(this.scene, prevHitArea, '');
}

prevHitArea.isDown = false;
prevHitArea.data.isDown = false;
}
}
if (key !== null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/rexuiplugin.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/bbcodetext/hitarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ class Demo extends Phaser.Scene {
//scene.input.manager.canvas.style.cursor = '';
})

var txt2 = this.add.rexBBCodeText(400, 300, '[area=1][hit me][/area]', {
var txt2 = this.add.rexBBCodeText(400, 300, '123 [area=1][hit me][/area]', {
backgroundColor: '#555',
fontSize: '24px'
})
.setInteractive()
.on('areaclick', function () {
// Clear hit-area
this.setText('123456')
this.setText('123')
});

}
Expand Down
Loading

0 comments on commit 830543f

Please sign in to comment.