@@ -159,6 +159,20 @@ export class Card extends Container {
159159 */
160160 enableHoverEffect ( ) {
161161 this . on ( 'pointerenter' , ( ) => {
162+ // Workaround for hover oscillation issue:
163+ // When a card moves on hover, the mouse pointer stays in place.
164+ // If the card moves away from the pointer, it may expose a neighbor card,
165+ // triggering that card's hover and causing the original card to "leave".
166+ // This creates an annoying oscillation between two cards.
167+ // Solution: expand the hit area on hover so the card "owns" the mouse
168+ // 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+ ) ;
175+
162176 if ( this . isParentHand ( ) ) {
163177 this . y = this . baseY - CARD_HEIGHT / 6 ;
164178 } else if ( this . isParentLeft ( ) || this . isParentRight ( ) ) {
@@ -167,6 +181,9 @@ export class Card extends Container {
167181 }
168182
169183 this . once ( 'pointerleave' , ( ) => {
184+ // Restore original hit area when hover ends
185+ this . hitArea = new Rectangle ( - CARD_WIDTH / 2 , - CARD_HEIGHT / 2 , CARD_WIDTH , CARD_HEIGHT ) ;
186+
170187 if ( this . isParentHand ( ) ) {
171188 this . y = this . baseY ;
172189 } else if ( this . isParentLeft ( ) || this . isParentRight ( ) ) {
0 commit comments