fix: add mobile check to a3013825

This commit is contained in:
trafficlunar 2025-02-22 18:04:31 +00:00
parent b58d778087
commit c99798ae65

View file

@ -1,5 +1,6 @@
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react"; import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import { useGesture } from "@use-gesture/react"; import { useGesture } from "@use-gesture/react";
import { isMobile } from "react-device-detect";
import * as PIXI from "pixi.js"; import * as PIXI from "pixi.js";
import { Container, Stage } from "@pixi/react"; import { Container, Stage } from "@pixi/react";
@ -177,8 +178,8 @@ function Canvas() {
(e: React.MouseEvent) => { (e: React.MouseEvent) => {
dragging.current = true; dragging.current = true;
if (isMobile) onPointerMove(e);
onToolUse(); onToolUse();
onPointerMove(e);
updateCssCursor(); updateCssCursor();
dragStartCoordsRef.current = mouseCoords; dragStartCoordsRef.current = mouseCoords;
@ -188,7 +189,7 @@ 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] [onPointerMove, onToolUse, updateCssCursor, mouseCoords, blocks, selectionCoords, tool, setSelectionCoords]
); );
const onPointerUp = useCallback(() => { const onPointerUp = useCallback(() => {