Commit graph

22 commits

Author SHA1 Message Date
isaprettycoolguy@protonmail.com
b69131f16d perf: cut redundant per-item work on map + table load
Map grid: the per-hex render loop called getTerrainFromFile +
getIconOverrideFromFile + getGmIconsFromFile, each re-running
getAbstractFileByPath + getFileCache — 3 identical cache lookups per hex
(~11.5k redundant ops on a 3843-hex map). Fetch frontmatter once and feed
three new pure extractors (terrainFromFm/iconOverrideFromFm/gmIconsFromFm).
Reuse the bg-image layer across renders (bgLayerEl/bgLayerSrc) so
renderGrid()'s viewportEl.empty() no longer re-decodes the image each time.
Tag painted hexes with .duckmage-hex-painted (setHexColor) and switch the
bg-image empty-hex rule to a class selector instead of a slower
:not([style*="background-color"]) attribute-substring match.

Table view: memoise the name→entry palette Map per region instead of
rebuilding it per row, and re-filter only the rows just filled in each batch
(applyFilters(rows?)) instead of re-scanning all rows after every batch.

Adds dev/bg-hex-recalc-bench + unit tests for the new pure extractors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 07:03:23 -04:00
isaprettycoolguy@protonmail.com
4cd0550a9a fix: render road/river chains in parallel + skip zoom-bake on bg-image maps
Path chains that share a route are stroked in path-type order, so a later
chain on the same hexes used to paint over the earlier one (hexmaker#30).
Add computeLaneOffsets() + offsetPolyline() (hexGeometry.ts): chains sharing
a segment are grouped via union-find and given symmetric perpendicular lane
offsets PER DISTINCT TYPE — same-type chains merge into one stroke, different
types fan out side by side. Chains with no shared segment keep offset 0, so
the common single-path case is pixel-identical. Wired into both the on-screen
overlay (renderPathOverlay) and the PNG exporter (mapPngRenderer) so they match.

Also fixes a macOS-only bg-image zoom drift: bakeZoom grows the em-based hex
grid via font-size while the px-based bg image is grown through a separate
multiply; device-pixel snapping on fractional/Retina DPR rounds the two paths
differently, so the grid slipped off the image on zoom settle. scheduleZoomBake
now skips baking whenever a bg image is present, keeping zoom as a single
composited viewport scale() that can't drift on any DPR.

Adds ISSUES.md (local mirror of open upstream issues for planning).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 06:56:46 -04:00
isaprettycoolguy@protonmail.com
f9e292c5f0 feat: faction & region overlay patterns (1.3.0)
Adds per-overlay pattern fills so factions and regions can be visually
distinguished when they overlap (issue #25). Each faction note and each
region note now carries a pattern, scale, and opacity in its
frontmatter, edited via the existing FactionEditor / GeoRegionEditor
modals (dropdown + sliders + live preview swatch).

Pattern set (10 total): solid (the existing flat fill, default),
diagonal stripes ↗ / ↖, crosshatch, polka dots, grid, zigzag,
triangles, scales, checker.

On screen: SVG <pattern> defs are deduped per (key,color,scale) and
referenced from each overlay path's fill. Stroke stays solid color so
blob boundaries remain crisp. Per-overlay opacity replaces the
hardcoded 0.45 group opacity.

PNG export: mirrored via Canvas patterns built from an offscreen tile
per (key,color,scale), cached for the render pass.

Backwards compatible — overlays without the new frontmatter keys fall
back to solid + 0.45 opacity, matching pre-1.3.0 behavior.
2026-06-17 11:53:04 -04:00
isaprettycoolguy@protonmail.com
6aa885b5b2 feat: export module — PDF/Markdown for notes, hexes, maps, tables, workflows (1.2.0)
Adds a unified export pipeline under src/export/ with exporters for single notes,
structured hexes, maps (with reference table), random tables, and workflows
(with rolled samples). PDF rendering reuses Obsidian's MarkdownRenderer + theme
CSS; map PNG/PDF goes through a dedicated canvas renderer.

UI surface:
- "Export" tab in MapModal (PNG/PDF with overlay + size options)
- "Export" link in HexEditorModal + HexExportModal
- "Export PDF/Markdown" links in RandomTableView header
- "Export…" button in WorkflowEditorModal + WorkflowExportModal
- Commands: export current note (PDF/MD), current hex, current workflow
- File-menu items on any .md file: Export to PDF / Markdown

Other:
- New `exportFolder` setting (defaults to {worldFolder}/exports)
- hexGeometry: add hexSize / hexCenter / hexPolygonPoints / gridBoundingBox
- HexTableView + HexEditorModal: first-wins on duplicate palette names
  (matches HexMapView's .find() behaviour)
- Tests: unit + integration suites for all exporters; sim-vault fixture

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 20:46:41 -04:00
isaprettycoolguy@protonmail.com
31d3256192 add submap links: link hex to another map, centre-dot nav, back button, map link insert
- Right-click hex → "Link submap" writes duckmage-submap frontmatter
- Hex flower shows centre dot (hidden when no link) that navigates into the submap
- Centre dot centering is orientation-aware (flat-top top:24px, pointy-top top:20px)
- ← Back button appears next to map dropdown (via flex nav group) after submap drill-in
- "Insert map link" editor context menu inserts obsidian://duckmage-openmap URI
- Map rename updates all duckmage-submap references via updateSubmapReferences()
- HexEditorOptions refactored: onNavigate/onModalClose/onSwitchMap in options object
- 10 new tests for submap frontmatter helpers and rename propagation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 12:29:22 -04:00
isaprettycoolguy@protonmail.com
a23a98b982 add token layer: place, edit, and inspect tokens on the hex map
- Tokens placed per-hex link to vault notes; support circle/square shape,
  sm/md/lg size, fill color, optional border color, icon, and description
- TokenInfoModal shows note content (formatted via MarkdownRenderer, images
  included) with jump-to-hex, open-note, edit, and two-step remove actions
- Edit flow reopens TokenModal pre-filled; proxy notes handle multiple tokens
  referencing the same source note
- Icon picker replaced with scrollable palette grid (2-row cap, drag-to-reorder,
  hide/show) in both HexEditorModal and TokenModal; order persisted in settings
- Token layer toggle added to layers menu (default on)
- Fix metadata-cache race on token delete (wasToken check prevents missed updates)
- Token preview rendered inline in TokenModal title row; real-time color preview
  via native input event on color pickers
- Bump version to 1.1.6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 08:26:20 -04:00
isaprettycoolguy@protonmail.com
d91ea4eb57 add initial gm layer pass 2026-05-10 16:22:38 -04:00
isaprettycoolguy@protonmail.com
37c4a866bc auto update links in the random tables 2026-04-04 11:51:53 -04:00
nyxsys
bac34d1050 fix a bunch of linter issues 2026-03-30 17:57:01 -04:00
nyxsys
ba3e1a1d6e use tsx for testing 2026-03-28 23:09:38 -04:00
isaprettycoolguy@protonmail.com
305cc24e70 switch out test suite to fix deprecation warning 2026-03-28 22:42:39 -04:00
isaprettycoolguy@protonmail.com
b1da4c3115 remove deprecated 2026-03-27 16:53:23 -04:00
isaprettycoolguy@protonmail.com
68d4edb65d reorganize files 2026-03-20 15:35:35 -04:00
isaprettycoolguy@protonmail.com
7557d18c2e expand tests and enhance workflow editing 2026-03-18 17:19:32 -04:00
isaprettycoolguy@protonmail.com
583c3f656e create workflow tool 2026-03-17 16:18:42 -04:00
isaprettycoolguy@protonmail.com
2447c12568 make it easy for user to add links to tables 2026-03-16 17:38:39 -04:00
isaprettycoolguy@protonmail.com
48d4b4ea5e add regions, fix abiliensure additional regions work properly with default setting and so on 2026-03-16 12:46:57 -04:00
isaprettycoolguy@protonmail.com
bdb9807e32 add click and d 2026-03-14 21:10:06 -04:00
isaprettycoolguy@protonmail.com
c7e177554c add delete table function to tree view 2026-03-14 20:32:10 -04:00
isaprettycoolguy@protonmail.com
9917c6483b update tests 2026-03-14 20:07:47 -04:00
isaprettycoolguy@protonmail.com
9250bd65b3 clean up table editing experience 2026-03-13 13:38:03 -04:00
isaprettycoolguy@protonmail.com
5fd49558fb add tests and set up the picker tool to change on selection 2026-03-12 20:21:11 -04:00