From 4c3d5746e8992c2446b437fbd0004302b47f2f77 Mon Sep 17 00:00:00 2001 From: Cam Proudlock Date: Mon, 17 Aug 2026 15:01:09 -0400 Subject: [PATCH] Fix the levels viewer: markers were drawn on whichever plan was showing --- CHANGELOG.md | 21 ++++++ frontend/package.json | 2 +- frontend/src/assets/style.css | 6 +- frontend/src/components/ShopFloorMap.vue | 35 ++++++++++ frontend/src/views/MapEditor.vue | 2 +- frontend/src/views/MapView.vue | 64 +++++++++++++++++-- frontend/src/views/SearchResults.vue | 13 +++- .../src/views/settings/FloorMapSettings.vue | 63 +++++++++++++++--- scripts/build-site.sh | 3 +- shopdb/__init__.py | 2 +- shopdb/core/api/search.py | 41 ++++++++---- 11 files changed, 214 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3abccbd8..9b2a0cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,17 @@ ADR-007 and ADR-002. ## [Unreleased] +## [0.11.1] - 2026-08-17 + +A patch release: the pagination-cap fixes, plus the documentation that missed the +0.11.0 installer. No application behaviour changed on the server and the plugin +contract stays at 0.20.0. + +`docs/UPGRADE.md` is one of the documents the Windows installer puts on the box, +and its buildings-and-levels section landed after 0.11.0 was tagged - so 0.11.0 +shipped the page an operator reads WHILE upgrading without the guidance about +that upgrade. An air-gapped server has no other way to reach it. + ### Fixed - Pickers and batch label sheets no longer stop at 100 rows. `perpage` is @@ -25,6 +36,16 @@ ADR-007 and ADR-002. `PrintedPartsLabels`, `MachineForm` and `NetworkDeviceForm`. Lists that render a page at a time are unchanged - they page deliberately. +### Changed + +- The installer now also ships `FLOOR-MAP.md`, the operator's page for loading + floor plans, placing markers and moving them when a plan changes. Same reason + the Windows runbooks ship: the box cannot reach the wiki. +- The bundled `UPGRADE.md` now carries the 0.11.0 section: an existing map is + preserved and nothing moves on screen, and replacing a blueprint with one of + different dimensions moves every marker on that level, so recalibrate from + landmarks rather than editing the level's width and height. + ## [0.11.0] - 2026-08-17 The floor map became a set of drawings instead of one picture. A site can hold diff --git a/frontend/package.json b/frontend/package.json index a8dfb8c6..b99bb900 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "shopdb-frontend", - "version": "0.11.0", + "version": "0.11.1", "private": true, "type": "module", "scripts": { diff --git a/frontend/src/assets/style.css b/frontend/src/assets/style.css index 364b2700..36e9d98c 100644 --- a/frontend/src/assets/style.css +++ b/frontend/src/assets/style.css @@ -33,6 +33,10 @@ --sidebar-bg: #00003d; --sidebar-text: #ffffff; --sidebar-width: 250px; + /* Vertical chrome around .main-content. A full-height page subtracts these; + hardcoding a different number is what put a scrollbar on the map. */ + --main-pad-top: 20px; + --main-pad-bottom: 70px; /* Hover variants */ --secondary-dark: #82503f; @@ -243,7 +247,7 @@ h1, h2, h3, h4, h5, h6 { .main-content { flex: 1; margin-left: var(--sidebar-width); - padding: 20px 10px 70px 10px; + padding: var(--main-pad-top) 10px var(--main-pad-bottom) 10px; overflow-x: hidden; } diff --git a/frontend/src/components/ShopFloorMap.vue b/frontend/src/components/ShopFloorMap.vue index b7de1c0e..cf6e9cf2 100644 --- a/frontend/src/components/ShopFloorMap.vue +++ b/frontend/src/components/ShopFloorMap.vue @@ -437,8 +437,18 @@ function renderMarkers() { overlayLayers.forEach(layer => layer.remove()) overlayLayers = [] + // Markers belong to ONE level (ADR-017). This is the drawing being shown, and + // anything positioned against a different one is not drawn on it. + const drawnLevel = drawnLevelId() ?? null + props.machines.forEach(item => { if (item.mapx == null || item.mapy == null) return + // A marker from another level, placed on THIS blueprint, looks entirely + // correct and points at the wrong part of the building - so it is omitted + // rather than approximated. A position with no level at all is omitted for + // the same reason: the map editor lists both, badged, so they can be fixed + // rather than silently misplaced here. + if ((item.levelid ?? null) !== drawnLevel) return // Transform coordinates (database Y is top-down, Leaflet is bottom-up) const leafletY = MAP_HEIGHT - item.mapy @@ -599,6 +609,31 @@ watch(() => props.theme, (newTheme) => { } }) +// Switching level changes the drawing, the coordinate space AND which markers +// belong on it. All three move together: the size is what marker coordinates +// mean, so swapping the image without the bounds would place every marker +// against the wrong scale, and keeping the markers would show the previous +// floor's assets on this floor's plan. +watch(() => drawnLevelId(), (levelid) => { + if (!map || !imageOverlay) return + + MAP_WIDTH = dimensionsFor(levelid).width + MAP_HEIGHT = dimensionsFor(levelid).height + const bounds = [[0, 0], [MAP_HEIGHT, MAP_WIDTH]] + + const url = blueprintUrlFor(props.theme, levelid) + // A level with no blueprint is left blank rather than showing the previous + // one, which would be a floor plan labelled as somewhere it is not. + imageOverlay.setUrl(url || '') + imageOverlay.setBounds(bounds) + + map.setMaxBounds(bounds) + map.setView([MAP_HEIGHT / 2, MAP_WIDTH / 2], map.getZoom()) + + renderMarkers() + loadOverlays() +}) + onMounted(async () => { // Load this facility's blueprint + dimensions before building the map so // bounds and coordinate math use the right size. Falls back to defaults. diff --git a/frontend/src/views/MapEditor.vue b/frontend/src/views/MapEditor.vue index 5d978e4b..48e07359 100644 --- a/frontend/src/views/MapEditor.vue +++ b/frontend/src/views/MapEditor.vue @@ -492,7 +492,7 @@ function cancelEdit() { .map-editor { display: flex; flex-direction: column; - height: calc(100vh - 40px); + height: calc(100vh - var(--main-pad-top) - var(--main-pad-bottom)); } .header-actions { diff --git a/frontend/src/views/MapView.vue b/frontend/src/views/MapView.vue index f6b001d6..724204a1 100644 --- a/frontend/src/views/MapView.vue +++ b/frontend/src/views/MapView.vue @@ -12,6 +12,17 @@