Rectangle drawing tool creates no room #1

Closed
opened 2026-08-02 14:42:33 +00:00 by Mark · 1 comment
Owner

Problem: In src/components/editor/FloorplanCanvas.tsx, the draw-rect drag state sets dragState but never computes the final rectangle dimensions or calls onAddRoom. The handleMouseUp callback for draw-rect is empty and only clears the drag state. The preview path also returns null. Consequently, clicking the rectangle tool and dragging on the canvas does not add a new room.

Files to modify:

  • src/components/editor/FloorplanCanvas.tsx

Acceptance criteria:

  • Track the current mouse position while dragging in draw-rect mode.
  • On mouse up, compute a normalized rectangle {x, y, width, height} snapped to the grid.
  • Call onAddRoom with the new rectangle shape.
  • Show a live preview of the rectangle while dragging.
  • Minimum width/height of 5 to avoid accidental zero-area rooms.
**Problem:** In `src/components/editor/FloorplanCanvas.tsx`, the `draw-rect` drag state sets `dragState` but never computes the final rectangle dimensions or calls `onAddRoom`. The `handleMouseUp` callback for `draw-rect` is empty and only clears the drag state. The preview path also returns `null`. Consequently, clicking the rectangle tool and dragging on the canvas does not add a new room. **Files to modify:** - `src/components/editor/FloorplanCanvas.tsx` **Acceptance criteria:** - Track the current mouse position while dragging in `draw-rect` mode. - On mouse up, compute a normalized rectangle `{x, y, width, height}` snapped to the grid. - Call `onAddRoom` with the new rectangle shape. - Show a live preview of the rectangle while dragging. - Minimum width/height of 5 to avoid accidental zero-area rooms.
Mark closed this issue 2026-08-11 12:07:06 +00:00
Author
Owner

Fixed in 1c0a244. The Rectangle tool now tracks the drag with a live dashed preview and creates the room from the drag rect on mouseup. Verified in the browser: drag (55,25)->(85,75) creates a 30x50 room; the old code only set dragState and never called onAddRoom.

Fixed in 1c0a244. The Rectangle tool now tracks the drag with a live dashed preview and creates the room from the drag rect on mouseup. Verified in the browser: drag (55,25)->(85,75) creates a 30x50 room; the old code only set dragState and never called onAddRoom.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/kimi_agent_home_assistant#1
No description provided.