Skip to content

Commit

Permalink
use clearShapes instead of setShapes for removing drawables
Browse files Browse the repository at this point in the history
  • Loading branch information
zackschuster committed Jun 24, 2024
1 parent c94a8cc commit b57edef
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/components/boards/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function Board({
const storeMakeMove = useStore(store, (s) => s.makeMove);
const setHeaders = useStore(store, (s) => s.setHeaders);
const deleteMove = useStore(store, (s) => s.deleteMove);
const clearShapes = useStore(store, (s) => s.clearShapes);
const setShapes = useStore(store, (s) => s.setShapes);
const setFen = useStore(store, (s) => s.setFen);

Expand Down Expand Up @@ -332,7 +333,7 @@ function Board({
<ActionIcon
variant={editingMode ? "filled" : "default"}
size="lg"
onClick={() => setShapes([])}
onClick={() => clearShapes()}
>
<IconEraser size="1.3rem" />
</ActionIcon>
Expand Down Expand Up @@ -405,12 +406,12 @@ function Board({
: editingMode
? "both"
: match(movable)
.with("white", () => "white" as const)
.with("black", () => "black" as const)
.with("turn", () => turn)
.with("both", () => "both" as const)
.with("none", () => undefined)
.exhaustive();
.with("white", () => "white" as const)
.with("black", () => "black" as const)
.with("turn", () => turn)
.with("both", () => "both" as const)
.with("none", () => undefined)
.exhaustive();
}, [practiceLock, editingMode, movable, turn]);

const theme = useMantineTheme();
Expand Down Expand Up @@ -595,15 +596,15 @@ function Board({
style={
isBasicAnnotation(currentNode.annotations[0])
? {
"--light-color": lightColor,
"--dark-color": darkColor,
}
"--light-color": lightColor,
"--dark-color": darkColor,
}
: undefined
}
className={chessboard}
ref={boardRef}
onClick={() => {
eraseDrawablesOnClick && setShapes([]);
eraseDrawablesOnClick && clearShapes();
}}
onWheel={(e) => {
if (enableBoardScroll) {
Expand Down

0 comments on commit b57edef

Please sign in to comment.