Dragonroll Frontend: Map Viewer adjustmentes #15

Closed
opened 2026-10-14 12:08:06 +00:00 by Syndria98 · 7 comments
Owner
  • When creating a map, the scale is snapped to values like 5.01, 5.51, 6.01, ...., make that you can put any decimal number
  • Add an outer margin on the content of the create map window.
  • Make that you can anchor a map on the note-container div, so that when switching between the notes button on the sidebar shows the current open notes and when clicking on the map sidebar button it displays the anchored map
- When creating a map, the scale is snapped to values like 5.01, 5.51, 6.01, ...., make that you can put any decimal number - Add an outer margin on the content of the create map window. - Make that you can anchor a map on the note-container div, so that when switching between the notes button on the sidebar shows the current open notes and when clicking on the map sidebar button it displays the anchored map
Syndria98 added the ai-ready label 2026-10-14 12:08:06 +00:00
Collaborator

I'll start by exploring the repository structure and the map-related code.

I'll start by exploring the repository structure and the map-related code.
Collaborator

Frontend deps are installed. Now let me create the shared map viewer pane component.

Frontend deps are installed. Now let me create the shared map viewer pane component.
Collaborator

Now updating the sidebar to anchor maps instead of opening a floating window:

Now updating the sidebar to anchor maps instead of opening a floating window:
Collaborator

Now the create map window fixes (scale snapping + outer margin):

Now the create map window fixes (scale snapping + outer margin):
Collaborator

Now let me add tests for the new anchored-map state and the create-map input constraints:

Now let me add tests for the new anchored-map state and the create-map input constraints:
Collaborator

Done — all three adjustments from the issue are implemented in the working tree.

1. Scale no longer snaps to 5.01 / 5.51 / 6.01

frontend/app/components/windows/CreateMapWindow.vue — the scale field was <input type="number" min="0.01" step="0.5">. A number input only accepts min + n × step, so with that minimum the only reachable values were 0.01, 0.51, …, 5.01, 5.51, …. It is now step="any" (plus inputmode="decimal"), keeping min="0.01" because the backend schema enforces the same positive minimum. Any decimal (5, 5.25, 3.75…) is accepted and stored as typed.

2. Outer margin in the create map window

The window body was width: 100% + padding: 10px 18px with default box-sizing, so it was 36 px wider than the window: content overflowed the frame and nothing inset it. It now has a real outer margin (margin: 10px, box-sizing: border-box, align-self: stretch) and fills/scrolls within the window height (flex: 1; min-height: 0).

3. Anchoring a map on the note container

  • frontend/app/services/Content.js gained the workspace pane state: ActivePane ('notes' | 'map'), AnchoredMap, SetActivePane, AnchorMap, ClearAnchoredMap.
  • The map viewer UI moved out of MapViewerWindow.vue into a new chrome-less frontend/app/components/viewer/map/MapViewerPane.vue (same zoom/pan/grid/fit/edit behaviour, keeps reacting to campaign-entry-updated). The floating window is now just WindowHandle + that pane.
  • Content.vue renders the pane inside the note-container area and swaps it with NoteContainer via v-show, so the open notes stay open while the map is displayed.
  • ContentSidebar.vue: clicking a map anchors it (instead of opening a window); the sidebar's notes button shows the open notes and the maps button shows the anchored map. The anchored entry is highlighted and badged. Anchoring closes a floating viewer for a map, deleting the anchored map or switching campaign clears the anchor, and a detach button in the anchored toolbar gives the map back a floating window (so the existing map_viewer window stays reachable). Opening a note from the sidebar or the search palette always brings the notes back to the front.
  • New strings campaigns.map.open-window / campaigns.map.anchored added to en, es, ca.

Verification

  • npm test → 20/20 passed, including the new tests/map-viewer.test.js (anchor/pane state transitions loaded in a node:vm with a ref stub, plus create-map-window scale/margin checks; I confirmed both new create-map assertions fail against the previous code).
  • npx nuxt build --dotenv .env.production → build completed successfully (only pre-existing warnings). I did not run the dev server against a live backend, so the flows were not exercised in a browser.
  • AGENTS.md updated for the Content.js service row, the new viewer/map/ component and §5.1.
Done — all three adjustments from the issue are implemented in the working tree. ## 1. Scale no longer snaps to `5.01 / 5.51 / 6.01` `frontend/app/components/windows/CreateMapWindow.vue` — the scale field was `<input type="number" min="0.01" step="0.5">`. A number input only accepts `min + n × step`, so with that minimum the only reachable values were `0.01, 0.51, …, 5.01, 5.51, …`. It is now `step="any"` (plus `inputmode="decimal"`), keeping `min="0.01"` because the backend schema enforces the same positive minimum. Any decimal (`5`, `5.25`, `3.75`…) is accepted and stored as typed. ## 2. Outer margin in the create map window The window body was `width: 100%` + `padding: 10px 18px` with default `box-sizing`, so it was 36 px wider than the window: content overflowed the frame and nothing inset it. It now has a real outer margin (`margin: 10px`, `box-sizing: border-box`, `align-self: stretch`) and fills/scrolls within the window height (`flex: 1; min-height: 0`). ## 3. Anchoring a map on the note container - `frontend/app/services/Content.js` gained the workspace pane state: `ActivePane` (`'notes'` | `'map'`), `AnchoredMap`, `SetActivePane`, `AnchorMap`, `ClearAnchoredMap`. - The map viewer UI moved out of `MapViewerWindow.vue` into a new chrome-less `frontend/app/components/viewer/map/MapViewerPane.vue` (same zoom/pan/grid/fit/edit behaviour, keeps reacting to `campaign-entry-updated`). The floating window is now just `WindowHandle` + that pane. - `Content.vue` renders the pane inside the note-container area and swaps it with `NoteContainer` via `v-show`, so the **open notes stay open** while the map is displayed. - `ContentSidebar.vue`: clicking a map **anchors** it (instead of opening a window); the sidebar's **notes** button shows the open notes and the **maps** button shows the anchored map. The anchored entry is highlighted and badged. Anchoring closes a floating viewer for a map, deleting the anchored map or switching campaign clears the anchor, and a `detach` button in the anchored toolbar gives the map back a floating window (so the existing `map_viewer` window stays reachable). Opening a note from the sidebar or the search palette always brings the notes back to the front. - New strings `campaigns.map.open-window` / `campaigns.map.anchored` added to `en`, `es`, `ca`. ## Verification - `npm test` → **20/20 passed**, including the new `tests/map-viewer.test.js` (anchor/pane state transitions loaded in a `node:vm` with a `ref` stub, plus create-map-window scale/margin checks; I confirmed both new create-map assertions fail against the previous code). - `npx nuxt build --dotenv .env.production` → build completed successfully (only pre-existing warnings). I did not run the dev server against a live backend, so the flows were not exercised in a browser. - `AGENTS.md` updated for the `Content.js` service row, the new `viewer/map/` component and §5.1.
Collaborator

Implementation is ready for review: #16

Implementation is ready for review: https://git.aranroig.com/Syndria98/dragonroll/pulls/16
Agent added the help wanted label 2026-10-14 12:35:05 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Syndria98/dragonroll#15