Skip to content

Commit 004bbc3

Browse files
committed
Feat: added polyline delete
1 parent a2a4e72 commit 004bbc3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/components/toolbar/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Tool, tools } from "./data";
1212

1313
const ToolBar = () => {
1414
const selectedTool = useSelector((state) => state.toolbar.selectedTool);
15+
const selectedPolylineId = store.getState().editor.selectedPolylineId;
1516

1617
const onEscape = useCallback(
1718
(event) => {
@@ -49,6 +50,9 @@ const ToolBar = () => {
4950
store.dispatch(showControls());
5051
if (tool === Tool.Shape) selectFirstShape();
5152
}
53+
if (tool !== Tool.Pen && selectedPolylineId) {
54+
store.dispatch(setSelectedPolylineId(null));
55+
}
5256
};
5357

5458
return (

src/hooks/events/workspace-click.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
addText,
1818
deleteBooth,
1919
deleteImage,
20+
deletePolyline,
2021
deleteSeat,
2122
deleteShape,
2223
deleteText,
@@ -94,6 +95,8 @@ const useWorkspaceClick = () => {
9495
store.dispatch(deleteText(e.target.id));
9596
} else if (e.target.nodeName === "image") {
9697
store.dispatch(deleteImage(e.target.id));
98+
} else if (e.target.nodeName === "polyline") {
99+
store.dispatch(deletePolyline(e.target.id));
97100
}
98101
}
99102
};

0 commit comments

Comments
 (0)