Skip to content

Floorplan image import (opacity, scale calibration, lock & aspect controls) - #7

Open
ecarlson88 wants to merge 1 commit into
masterfrom
claude/gallant-hypatia-q20p5m
Open

Floorplan image import (opacity, scale calibration, lock & aspect controls)#7
ecarlson88 wants to merge 1 commit into
masterfrom
claude/gallant-hypatia-q20p5m

Conversation

@ecarlson88

Copy link
Copy Markdown
Owner

Description

Re-applies the floorplan/reference-image import on top of the current upstream master (02728eb), after the fork was re-synced and the previous commits were discarded.

The feature itself is unchanged:

  • Image node reused across both ReactFlow canvases (ImageNode), with drag + NodeResizer.
  • Opacity slider and an Image Properties editor modal, mirroring the existing annotation editor pattern.
  • Scale calibration — draw a line over a known real-world dimension to derive pixels-per-unit.
  • Lock position and lock/maintain aspect ratio controls (persistent toggle + hold-Shift during resize).
  • New Floorplan page type with its own isolated per-page node array; persists through save/load/export and is covered by undo/redo.

Rebase notes

38 upstream commits landed since this feature's previous base, including two changes that are structurally parallel to it — a new patch-panel page type and a new TextStubNode. Conflicts were resolved to keep both sides, not to pick one:

  • types.tsSchematicNode now carries both TextStubNode and ImageNode; SchematicPage is RackElevationPage | PrintSheetPage | PatchPanelViewPage | FloorplanPage.
  • store.ts — kept both mapFloorplanPage and upstream's stripDeadHops; kept both patch-panel and floorplan guards in syncRackCounters (neither page type has .racks); took upstream's early-return form in the rack-move path.
  • App.tsx / PageTabs.tsx — both the patch-bay and floorplan branches coexist across the render ternary, rename, delete, duplicate, and the add-page buttons.

One fix worth calling out: the tab-variant computation had auto-merged into two half-complete versions side by side (upstream's covered print | patch | rack, this feature's covered print | floorplan | rack), so neither handled all four page types. These were collapsed into a single TabVariant computation covering all four, with tabClass switched to a palette-map lookup — upstream's sky patch colors and this feature's teal floorplan colors are both preserved, so no styling changes.

Testing

Full local CI-equivalent, all green:

  • npm run build (incl. tsc -b) — passes
  • npm run lint0 errors (3 warnings, all pre-existing upstream in devices/ and DeviceEditor.tsx)
  • npm test525 tests across 52 files pass
  • npm run routing:check — 13/13 fixtures ok (no changes), no baseline drift
  • npm run reports:check — 2/2 fixtures OK

Screenshots


Generated by Claude Code

…pect controls

Introduce a reusable `image` ReactFlow node type for importing floorplan/
reference images on the main schematic canvas and on a new dedicated
"Floorplan" page type.

- New `image` node (ImageNode): renders an <img> with adjustable opacity,
  drag to move, NodeResizer to resize, sits behind devices (zIndex -10).
- Image Properties modal (ImagePropertiesEditor): opacity slider (mirrors
  annotation properties), scale calibration sub-modal (draw a line across a
  known distance to derive pixels-per-unit), lock-aspect-ratio toggle, and
  lock-position toggle.
- Aspect ratio: persistent lock-aspect toggle plus hold-Shift during resize
  for a temporary constraint (reuses a global shiftHeld flag; no new keybind).
- Lock position: mirrors the existing room lock (pinned, non-draggable,
  handles hidden, pane clicks pass through).
- New Floorplan page type: its own isolated ReactFlow canvas storing its own
  node array; full tab support (add/rename/duplicate/delete) in PageTabs.
- Image import util (imageImport.ts): FileReader + canvas downscale, returns
  natural dimensions; wired into the Insert menu (schematic) and an Add Image
  button (floorplan).
- Exclude image nodes from edge-routing obstacles so backgrounds don't block
  connections.

https://claude.ai/code/session_01JucvboMYPT8ppBUUsVsyXy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants