fix: mobile tapping to move cursor
This commit is contained in:
parent
ee94b224af
commit
a301382515
1 changed files with 14 additions and 10 deletions
|
|
@ -173,19 +173,23 @@ function Canvas() {
|
||||||
[dragging, coords, scale, tool, mouseCoords, onToolUse, setCoords]
|
[dragging, coords, scale, tool, mouseCoords, onToolUse, setCoords]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onPointerDown = useCallback(() => {
|
const onPointerDown = useCallback(
|
||||||
dragging.current = true;
|
(e: React.MouseEvent) => {
|
||||||
|
dragging.current = true;
|
||||||
|
|
||||||
onToolUse();
|
onToolUse();
|
||||||
updateCssCursor();
|
onPointerMove(e);
|
||||||
|
updateCssCursor();
|
||||||
|
|
||||||
dragStartCoordsRef.current = mouseCoords;
|
dragStartCoordsRef.current = mouseCoords;
|
||||||
startBlocksRef.current = [...blocks];
|
startBlocksRef.current = [...blocks];
|
||||||
startSelectionCoordsRef.current = [...selectionCoords];
|
startSelectionCoordsRef.current = [...selectionCoords];
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue