Skip to content

Commit 3e8da89

Browse files
committed
Expand the hit area only vertically
1 parent b5d2db1 commit 3e8da89

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

playing-cards-2-planes/Card.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,7 @@ export class Card extends Container {
166166
// This creates an annoying oscillation between two cards.
167167
// Solution: expand the hit area on hover so the card "owns" the mouse
168168
// position even after moving, preventing the neighbor from triggering.
169-
this.hitArea = new Rectangle(
170-
-CARD_WIDTH / 2 - HOVER_DISTANCE,
171-
-CARD_HEIGHT / 2 - HOVER_DISTANCE,
172-
CARD_WIDTH + 2 * HOVER_DISTANCE,
173-
CARD_HEIGHT + 2 * HOVER_DISTANCE
174-
);
169+
this.hitArea = new Rectangle(-CARD_WIDTH / 2, -CARD_HEIGHT / 2, CARD_WIDTH, CARD_HEIGHT + 1.5 * HOVER_DISTANCE);
175170

176171
if (this.isParentHand()) {
177172
this.y = this.baseY - CARD_HEIGHT / 6;

0 commit comments

Comments
 (0)