ADR 0066: The floor view is an SVG drawing of the layout, with racks inside each aisle's cell and bays drawn only up close
Status: Accepted
Context
ADR 0065 stored what the floor needs and made every Facility's floor plan carry a building and its doors. The owner approved the floor view as four pull requests; this is the third: the page that draws it. The approved design is quiet by default: neutral colour, labels only for exceptions and a few anchors, detail on hover and on a click, light and dark, a desktop box and a phone box. It was drawn as an oblique SVG. The Home page already has a three.js model of the warehouse.
The floor plan serves each aisle's line (its walking line), its length, its sizes and its walking aisle. It does not serve whether an aisle is double-sided, and a location's point is the aisle line, not a place across the rack.
Decision
- The renderer is React and inline SVG, not three.js. The scene is a pure function from the floor plan
and the locations to a list of shapes in metres (
pages/floor/floor-scene.ts); the projection and the paint order are plain modules that a test runs without a browser. SVG follows the Daylight Ledger roles through CSS, so the night theme needs no second drawing, and it renders in the test environment. The three.js model on Home stays as it is; Home links to the floor view. - The projection is oblique: the along axis 18 degrees below the horizontal, the across axis 42 degrees. Shapes paint in layers (yard, floor, back walls, racks, front walls) and, inside a layer, from far to near by a depth key. Racks that do not overlap are ordered by their nearest bottom corner.
- Racks are drawn inside each aisle's cell. An aisle's line is where a person stands to pick, and ADR 0060 puts the first aisle of a zone on the zone's start, so racks drawn on both sides of the line would reach half a spacing before the zone, outside the building. The floor view draws the cell from the aisle's line to the next aisle's: a rack on the far edge, or one on each edge with the walking aisle between. Locations keep their points; only the rack is drawn in the cell.
- The number of rack faces is read from the walking aisle, because the floor plan has no double-sided flag: faces are the spacing less the walking aisle, divided by the rack depth, rounded. Two sizes that leave no walking aisle (clamped to zero) read as one face when the spacing is less than one and a half rack depths, which can draw a double-sided aisle with one rack. No reason is recorded for not serving the flag; serving it would remove the guess.
- Detail follows the camera scale, in screen pixels for each metre. Racks, rooms, doors and the zone and door-group names draw at every scale. From 9 pixels for each metre, bays draw one by one (their fill and lock, in the lens colour), with door and aisle names; from 24, each bay carries its name. Bays draw one by one only while at most 1,500 are in view, and loose locations (at a floor point of their own) draw up to 1,500 tiles, so a Facility with tens of thousands of bays stays responsive.
- Colour means one thing. Racks, walls and floors are neutral; red is a location under a lock; the primary colour is only the selection. Stock is a neutral ramp of fill, not a colour, and amber is not used until a figure can be amber (a room outside its set point, which ADR 0067 adds).
- Read-only, and honest about what it leaves out. The page reads the floor plan and the locations
floor read, both under
layout.read. The first version drew no people, trucks or temperatures; ADR 0067 adds them, each behind the action its data needs. A derived building or door is badged Derived. - The drawing is hidden from a screen reader, and every record is also a button in a list under it. The list also holds the locked bays and the loose location tiles, up to 1,500 of each; ordinary bays are reached from the Locations page. The camera has no easing, so reduced motion needs no branch.
Consequences
The page costs one more read of two endpoints Karyo already serves, and no backend change. A change to the floor plan's response is a change to the page's scene, so the scene tests are the contract. The cell convention means the picture is a good drawing of the layout and not a survey: a rack can stand up to half a spacing from where a surveyor would measure it.
The live layers (people, trucks and room temperatures, ADR 0067) add shapes to this scene without changing the projection or the paint order.
Alternatives considered
- three.js. Already a dependency, and it would give free orbit. It is harder to test, does not follow the CSS roles, needs WebGL, and the approved look is the flat oblique drawing.
- Racks centred on the aisle line. Closer to where a location is, and outside the building for the first aisle of every zone that starts at the building's edge.
- Drawing every bay at every scale. The approved design draws labels only up close, and a layout of tens of thousands of bays cannot be a single SVG.
Evidence
frontend/web/src/pages/floor/projection.tsfrontend/web/src/pages/floor/floor-scene.tsfrontend/web/src/pages/floor/floor-plan-items.tsfrontend/web/src/pages/floor/floor-building.tsfrontend/web/src/pages/floor/floor-detail.tsfrontend/web/src/pages/floor/floor-svg.tsxfrontend/web/src/pages/floor/floor-page.tsxfrontend/web/src/pages/floor/__tests__/floor-scene.test.tsfrontend/web/src/pages/floor/__tests__/floor-page.test.tsx