fix: change cursor to move when using move tool
This commit is contained in:
parent
065f8bcf59
commit
ade77b7ce6
2 changed files with 7 additions and 11 deletions
|
|
@ -82,6 +82,7 @@ function Canvas() {
|
||||||
const updateCssCursor = useCallback(() => {
|
const updateCssCursor = useCallback(() => {
|
||||||
const cursorMapping: Partial<Record<Tool, string>> = {
|
const cursorMapping: Partial<Record<Tool, string>> = {
|
||||||
hand: dragging ? "grab" : "grabbing",
|
hand: dragging ? "grab" : "grabbing",
|
||||||
|
move: "move",
|
||||||
zoom: holdingAltRef.current ? "zoom-out" : "zoom-in",
|
zoom: holdingAltRef.current ? "zoom-out" : "zoom-in",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,18 +27,13 @@ export const ToolProvider = ({ children }: Props) => {
|
||||||
const [cssCursor, setCssCursor] = useState("crosshair");
|
const [cssCursor, setCssCursor] = useState("crosshair");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
switch (tool) {
|
const cursorMapping: Partial<Record<Tool, string>> = {
|
||||||
case "hand":
|
hand: "grab",
|
||||||
setCssCursor("grab");
|
move: "move",
|
||||||
break;
|
zoom: "zoom-in",
|
||||||
case "zoom":
|
};
|
||||||
setCssCursor("zoom-in");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
setCssCursor(cursorMapping[tool] || "crosshair");
|
||||||
setCssCursor("crosshair");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}, [tool]);
|
}, [tool]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue