refactor: rename elementType to activeTool and make it an object (#4968)

* refactor: rename elementType to activeTool

* update docs

* fix snap

* update activeToll to be an object and review fixes

* fix tests

* fix
This commit is contained in:
Aakansha Doshi 2022-03-25 20:46:01 +05:30 committed by GitHub
parent 2209e2c1e8
commit 127af9db23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 364 additions and 207 deletions

View file

@ -268,13 +268,13 @@ export const setCursorForShape = (
if (!canvas) {
return;
}
if (appState.elementType === "selection") {
if (appState.activeTool.type === "selection") {
resetCursor(canvas);
} else if (appState.elementType === "eraser") {
} else if (appState.activeTool.type === "eraser") {
setEraserCursor(canvas, appState.theme);
// do nothing if image tool is selected which suggests there's
// a image-preview set as the cursor
} else if (appState.elementType !== "image") {
} else if (appState.activeTool.type !== "image") {
canvas.style.cursor = CURSOR_TYPE.CROSSHAIR;
}
};