Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Commit bcf3212

Browse files
author
ge85riz
committed
🎨 feat(frontend): when undo action is triggered, reset QuickWall feature
1 parent f2082c2 commit bcf3212

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

frontend/src/components/canvas/EventListeners.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,14 +514,14 @@ export const handleTransformEnd = (transformerRef, state: AppState, dispatch: (a
514514
id,
515515
radius: el.radius ? Math.max(10, el.radius * scaleX) : undefined,
516516
rotation: node.rotation(),
517-
x: el.x!,
518-
y: el.y!,
517+
x: node.x()!,
518+
y: node.y()!,
519519
}
520520
: el.type !== "wall" && el.type !== "arrow"
521521
? {
522522
id,
523-
x: node.x()! / scaleX,
524-
y: node.y()! / scaleY,
523+
x: node.x()!,
524+
y: node.y()!,
525525
width: el.width ? Math.max(10, el.width * scaleX) : undefined,
526526
height: el.height ? Math.max(10, el.height * scaleY) : undefined,
527527
rotation: node.rotation(),

frontend/src/components/canvas/KonvaCanvas.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ function KonvaCanvas({ stageReference, schematicsUUID, isFullWidth }: KonvaCanva
142142
}
143143
}, [selectedIds]);
144144

145+
useEffect(() => {
146+
if (state.buildMode === 0) setQuickWallCoordinates({ x1: undefined, y1: undefined });
147+
}, [state.buildMode]);
148+
145149
useEffect(() => {
146150
const handleKeyDownWrapper = (e: KeyboardEvent) => {
147151
handleKeyDown(e, dispatch, setSelectedIds, setIsShiftPressed, selectedIds, setQuickWallCoordinates, state);

frontend/src/components/canvas/reducers/CanvasReducer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ export function reducer(state: AppState, action: Action) {
227227

228228
return {
229229
...previous,
230+
buildMode: 0,
230231
history: {
231232
past: [...newPast],
232233
future: bypassRedo ? [...future] : [...future, { ...state }],

0 commit comments

Comments
 (0)