fix: mobile tapping to move cursor

This commit is contained in:
trafficlunar 2025-02-21 21:45:59 +00:00
parent ee94b224af
commit a301382515

View file

@ -173,10 +173,12 @@ function Canvas() {
[dragging, coords, scale, tool, mouseCoords, onToolUse, setCoords] [dragging, coords, scale, tool, mouseCoords, onToolUse, setCoords]
); );
const onPointerDown = useCallback(() => { const onPointerDown = useCallback(
(e: React.MouseEvent) => {
dragging.current = true; dragging.current = true;
onToolUse(); onToolUse();
onPointerMove(e);
updateCssCursor(); updateCssCursor();
dragStartCoordsRef.current = mouseCoords; dragStartCoordsRef.current = mouseCoords;
@ -185,7 +187,9 @@ function Canvas() {
// Clear selection on click // Clear selection on click
if (tool === "rectangle-select") setSelectionCoords([]); if (tool === "rectangle-select") setSelectionCoords([]);
}, [onToolUse, updateCssCursor, mouseCoords, blocks, selectionCoords, tool, setSelectionCoords]); },
[onToolUse, updateCssCursor, mouseCoords, blocks, selectionCoords, tool, setSelectionCoords]
);
const onPointerUp = useCallback(() => { const onPointerUp = useCallback(() => {
dragging.current = false; dragging.current = false;