fix: change cursor to move when using move tool

This commit is contained in:
trafficlunar 2025-01-22 20:24:40 +00:00
parent 065f8bcf59
commit ade77b7ce6
2 changed files with 7 additions and 11 deletions

View file

@ -82,6 +82,7 @@ function Canvas() {
const updateCssCursor = useCallback(() => {
const cursorMapping: Partial<Record<Tool, string>> = {
hand: dragging ? "grab" : "grabbing",
move: "move",
zoom: holdingAltRef.current ? "zoom-out" : "zoom-in",
};

View file

@ -27,18 +27,13 @@ export const ToolProvider = ({ children }: Props) => {
const [cssCursor, setCssCursor] = useState("crosshair");
useEffect(() => {
switch (tool) {
case "hand":
setCssCursor("grab");
break;
case "zoom":
setCssCursor("zoom-in");
break;
const cursorMapping: Partial<Record<Tool, string>> = {
hand: "grab",
move: "move",
zoom: "zoom-in",
};
default:
setCssCursor("crosshair");
break;
}
setCssCursor(cursorMapping[tool] || "crosshair");
}, [tool]);
return (