fix(dominion): prevent card interaction during draw animations
- Defer hover and interactivity attachment until cards are fully visible - Re-enable interactivity after draw/discard animations complete - Prevents accidental card clicks during animation transitions
This commit is contained in:
parent
1e607e5802
commit
01dcfbfd85
|
|
@ -616,8 +616,11 @@ export default class DominionGame extends Phaser.Scene {
|
|||
this.dynamicLayer.add(face);
|
||||
const hit = this.add.rectangle(x, baseY, HAND_W, HAND_H, 0x000000, 0).setDepth(D.hand + i + 1);
|
||||
this.dynamicLayer.add(hit);
|
||||
// Only attach hover and interactivity once the card is visible (not animating in).
|
||||
if (!this._animatingIids.has(c.iid)) {
|
||||
this.attachHover(hit, def);
|
||||
hit.setInteractive({ useHandCursor: true });
|
||||
}
|
||||
const hs = { iid: c.iid, id: c.id, def, x, baseY, face, hit, isPlayableAction, isPlayableTreasure };
|
||||
this.handSprites.push(hs);
|
||||
|
||||
|
|
@ -2429,7 +2432,14 @@ export default class DominionGame extends Phaser.Scene {
|
|||
_finishDrawAnim() {
|
||||
this._deckAnimDisplay = null;
|
||||
this._discardAnimDisplay = null;
|
||||
this.handSprites.forEach(s => s.face.setAlpha(1));
|
||||
this.handSprites.forEach(s => {
|
||||
s.face.setAlpha(1);
|
||||
// Re-enable hover and interactivity now that the card is visible.
|
||||
if (!s.hit.input?.enabled) {
|
||||
this.attachHover(s.hit, s.def);
|
||||
s.hit.setInteractive({ useHandCursor: true });
|
||||
}
|
||||
});
|
||||
this._animatingIids.clear();
|
||||
this._animating = false;
|
||||
this._suppressTurnUi = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue