Skip to content

Commit 261a799

Browse files
committed
Add interactive map viewer journal page (Phase 1)
Register a custom JournalPageSheet for image-type journal pages that provides an interactive map viewer with pin placement, zoom/pan, and real-time Foundry socket sync between clients. Features: - 6 pin types (location, danger, treasure, quest, note, text) with colored icons matching Chronicle's marker categories - Mouse wheel zoom (0.25x-4x) with cursor-anchored scaling - Click-drag pan navigation with fit-to-view - Pin placement via toolbar selection + map click - Drag pins to reposition (coordinates stored as 0-100%) - Right-click pin to open config dialog (label, type, description, visibility, journal link) - Double-click pin to open linked JournalEntry - GM-only pin visibility toggle - Toggle pin labels on/off - Real-time multi-client sync via Foundry socket channel - PinConfigDialog using ApplicationV2/HandlebarsApplicationMixin pattern New files: - scripts/map-viewer.mjs (MapViewerSheet + PinConfigDialog) - templates/map-viewer.hbs (viewer template) - templates/pin-config.hbs (pin config dialog template) - styles/map-viewer.css (all styles scoped to .chronicle-map-viewer) Modified files: - scripts/module.mjs (import + register sheet in init hook) - scripts/map-sync.mjs (export PIN_ICONS for reuse) - module.json (add map-viewer.css to styles) - lang/en.json (add MapViewer i18n strings) https://claude.ai/code/session_01WgrfTebnxho2b8nLgnA8eb
1 parent 9d3a9da commit 261a799

8 files changed

Lines changed: 1083 additions & 2 deletions

File tree

lang/en.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,32 @@
179179
"Reconnect": "Reconnect"
180180
}
181181
},
182+
"MapViewer": {
183+
"SheetLabel": "Chronicle Map Viewer",
184+
"PlacePin": "Click map to place pin",
185+
"PinConfig": "Configure Pin",
186+
"PinLabel": "Label",
187+
"PinType": "Type",
188+
"PinDescription": "Description",
189+
"PinShared": "Visible to players",
190+
"PinLinkedJournal": "Linked Journal",
191+
"PinSave": "Save",
192+
"PinDelete": "Delete Pin",
193+
"PinDeleteConfirm": "Delete this pin?",
194+
"ZoomIn": "Zoom In",
195+
"ZoomOut": "Zoom Out",
196+
"ZoomReset": "Reset Zoom",
197+
"FitView": "Fit to View",
198+
"ToggleLabels": "Toggle Labels",
199+
"PinTypes": {
200+
"location": "Location",
201+
"danger": "Danger",
202+
"treasure": "Treasure",
203+
"quest": "Quest",
204+
"note": "Note",
205+
"text": "Text Label"
206+
}
207+
},
182208
"Wizard": {
183209
"Title": "Chronicle Import Wizard",
184210
"OpenWizard": "Setup Wizard",

module.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
],
2424
"styles": [
2525
"styles/chronicle-sync.css",
26-
"styles/import-wizard.css"
26+
"styles/import-wizard.css",
27+
"styles/map-viewer.css"
2728
],
2829
"languages": [
2930
{

scripts/map-sync.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ export class MapSync {
611611
* Pin category → Foundry icon and color mapping.
612612
* Icons are from Foundry's bundled icon set.
613613
*/
614-
const PIN_ICONS = {
614+
export const PIN_ICONS = {
615615
location: { icon: 'icons/svg/village.svg', color: '#3B82F6', faIcon: 'fa-map-pin' },
616616
danger: { icon: 'icons/svg/skull.svg', color: '#EF4444', faIcon: 'fa-skull' },
617617
treasure: { icon: 'icons/svg/chest.svg', color: '#F59E0B', faIcon: 'fa-gem' },

0 commit comments

Comments
 (0)