You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// in order to prevent onTouchEnd from firing if we are dragging within the same square, we need to store if a touch has started so that we can reset it if we drag, and if it isn't reset by the time the touch ends, we know it was a tap and can fire the click event
120
+
setIsClickingOnMobile(true);
121
+
}}
109
122
onTouchEnd={(e)=>{
110
123
// Prevent default to avoid double-firing with onClick on some devices
111
124
e.preventDefault();
112
-
onSquareClick?.({
113
-
piece: currentPosition[squareId]??null,
114
-
square: squareId,
115
-
});
125
+
126
+
// we only want to fire onSquareClick if the touch event ended within the same square as it started
0 commit comments