Commit graph

115 commits

Author SHA1 Message Date
Claude
3d30e2481e
fix(obsidian): attempt to use search endpoint for recursive file listing
- Try /search/ endpoint first to get all .md files recursively
- Fall back to /vault/ endpoint if search doesn't work
- Add warning when using /vault/ that nested folders may not be visible
- Handle multiple response formats from search endpoint
2025-11-14 04:57:18 +00:00
Claude
adb04d2e43
debug(obsidian): add logging to diagnose nested folder display issue
- Add debug logging to getVaultFiles() to show file counts
- Add logging to listAllNotes() to show processing details
- Add logging to buildFolderTree() to trace folder creation
- Filter .md files in getVaultFiles() for better performance
- Log sample file paths to help diagnose API response format

This will help identify why nested folders aren't appearing in the
folder tree browser.
2025-11-14 04:50:05 +00:00
Claude
154145a518
feat(obsidian): persist FMG-to-note association with fmg-id in frontmatter
When a user selects or creates a note for a burg/marker, the system now
automatically links them together by adding/updating the note's frontmatter.

**How it works:**

1. **When saving a note**:
   - Adds `fmg-id: burg123` to frontmatter
   - Updates `x:` and `y:` coordinates
   - Preserves existing frontmatter fields

2. **When creating a new note**:
   - Template includes fmg-id from the start
   - Uses the proper elementId (e.g., "burg123")

3. **Next time you edit**:
   - System finds note instantly by fmg-id
   - No need to search by coordinates again
   - Permanent two-way link established

**Changes:**
- obsidian-notes-editor.js:
  - Pass elementId and coordinates to showMarkdownEditor()
  - updateFrontmatterWithFmgData() injects fmg-id on save
  - Automatically updates coordinates to keep in sync
- obsidian-bridge.js:
  - generateNoteTemplate() accepts elementId parameter
  - Uses elementId for fmg-id instead of element.id

Users no longer need to manually match notes - once linked, the
association is permanent in the note's frontmatter.
2025-11-14 04:22:24 +00:00
Claude
28cf8db82d
feat(obsidian): add text search and browse features for note finding
Enhanced the Obsidian note finding system with:

**ObsidianBridge:**
- searchNotes(query): Search vault by filename
- listAllNotes(): Browse all notes in vault

**Obsidian Notes Editor:**
- Text search box with auto-populated state/province
- "Browse All Notes" button to see full vault
- Display burg's state and province in dialog
- Pre-fill search with state name for easier finding
- Enter key triggers search
- Click any result to load that note

**getElementData enhancement:**
- Extract and include state/province names for burgs
- Extract state/province from cell data for markers

Now users can:
1. See which state/province the burg belongs to
2. Search by state name (pre-filled)
3. Search by any text in filename
4. Browse all notes manually
5. Click to select matching note

This addresses the user's organization structure where notes are
stored in State/Province folders matching the map structure.
2025-11-14 04:18:20 +00:00
Claude
de926c5456
chore: remove debug logging from default map feature 2025-11-14 03:55:45 +00:00
Claude
390e70f63a
debug: add logging to troubleshoot default map issue 2025-11-14 03:43:51 +00:00
Claude
45f56b8c5d
fix: persist onloadBehavior setting for default map feature
The default map feature was not working on page refresh because the
onloadBehavior dropdown value was not being persisted or restored.

Changes:
- main.js: Restore onloadBehavior from localStorage on page load
- save.js: saveAsDefaultMap() now saves "default" to localStorage
- save.js: clearDefaultMap() now removes the localStorage setting
- index.html: Update version hashes to 1.108.13

Now when users click "Set as default", the setting persists across
page refreshes and their default map loads automatically.
2025-11-14 03:38:33 +00:00
Claude
57b7980dbc
fix(v1.108.13): add comprehensive race condition guards in load.js
Add typeof checks for all function calls to modules loaded with defer attribute.
This prevents ReferenceError when loading old maps (1.108.11) in version 1.108.13.

Functions protected:
- getCurrentPreset() - from style.js
- addCustomColorScheme() - from style.js
- updateTextureSelectValue() - from style.js
- focusOn() - from editors.js
- invokeActiveZooming() - from zoom.js
- fitMapToScreen() - from zoom.js
- declareFont() - from fonts.js
- moveBurgToGroup() - from burgs.js (3 locations)

This fixes zoom/pan issues when loading old maps.
2025-11-14 03:30:12 +00:00
Claude
74b9310c57
fix: check if updateTextureSelectValue is defined before calling 2025-11-14 03:22:23 +00:00
Claude
8d7a1635f9
fix: prevent ReferenceError when loading maps before style.js loads
Check if heightmapColorSchemes is defined before accessing it to
prevent race condition between load.js and style.js initialization.
2025-11-14 03:10:35 +00:00
Claude
769d3a31bb
feat: add Obsidian vault integration for modern Markdown notes
Add comprehensive Obsidian integration as intermediate step toward
PostgreSQL migration, enabling modern Markdown-based note editing:

**Features:**
- Obsidian Local REST API integration for vault access
- Coordinate-based note matching (searches vault YAML frontmatter)
- Shows top 5-8 closest matches when clicking burgs/markers
- Modern Markdown editor with live preview
- [[Wikilink]] support for connecting notes
- "Open in Obsidian" button to jump to native app
- Configuration UI for API setup and testing

**Technical Implementation:**
- modules/io/obsidian-bridge.js - Core API integration layer
- modules/ui/obsidian-notes-editor.js - Markdown editor UI
- modules/ui/obsidian-config.js - Configuration panel
- OBSIDIAN_INTEGRATION.md - Complete setup/usage guide

**Coordinate Matching:**
- Parses YAML frontmatter for x/y coordinates
- Calculates distance to clicked element
- Supports nested (coordinates.x) and flat (x:) formats
- Handles missing FMG IDs (common with PostgreSQL imports)

**User Workflow:**
1. Configure Obsidian REST API connection
2. Click burg/marker in FMG
3. System finds matching notes by coordinates
4. Select note or create new one
5. Edit in modern Markdown editor
6. Save syncs to Obsidian vault instantly

This replaces the "Win95-style TinyMCE" editor with a clean,
modern Markdown experience while maintaining compatibility with
the eventual PostgreSQL backend migration. Users can edit notes
in either FMG or Obsidian - both stay in sync via file system.

Version: 1.108.13
2025-11-14 02:57:07 +00:00
Claude
acc2d112f3
feat: add default map setting feature
Add ability to set a specific map as the default that opens on load:

- Add 'Open default map' option to onload behavior dropdown
- Implement saveAsDefaultMap() to store map as default in IndexedDB
- Implement clearDefaultMap() to remove default map setting
- Modify checkLoadParameters() to load default map when configured
- Add UI buttons in Save dialog for setting/clearing default map
- Update version to 1.108.12 and hash in index.html

Users can now:
1. Open any map they want as default
2. Go to Options > Onload behavior > Select "Open default map"
3. Save > Click "Set as default" button
4. The map will now open automatically every time

This sets the foundation for the planned time-based worldbuilding
and lore database features by ensuring users always start with
their primary world map.
2025-11-14 02:33:16 +00:00
Azgaar
d06ebe5ac8 fix(v1.108.11): add external icons to export in base64 format 2025-07-18 02:31:10 +02:00
Greger
004097ef93
Make id field in exports more consistent. (#1210)
The id field for geojson export was not consistent with csv exports.
Removes the prefix on routes, rivers and markers geojson, and on
markers csv, to make them all use only an integer as id.

This makes it easier to import and do joins in other software.
2025-06-11 00:42:31 +02:00
Azgaar
764993b680 fix: remove old feature masks, v1.108.0 2025-02-15 13:06:14 +01:00
Azgaar
e39ca793f2 feat: add growthRate to safe file 2025-02-13 02:54:37 +01:00
Azgaar
01a69fd40b Merge branch 'master' of https://github.com/Azgaar/Fantasy-Map-Generator 2025-02-08 15:13:23 +01:00
Azgaar
22636b1b62 fix: data integrity checks - better Stripping issue detection, v1.107.1 2025-02-08 15:12:57 +01:00
Azgaar
0be14790d2 feat: rerender affected layers on auto-update 2025-02-08 14:15:59 +01:00
Azgaar
d51deffdac feat: make lined icons work for all elements, v1.107.0 2025-02-08 14:05:28 +01:00
Issac411
7b8ffd025f
custom pictures for regiments (#1183)
* forms and ajustements

* variable size for style as requested
2025-01-19 23:29:27 +01:00
Azgaar
03c7db32ef fix: #1172 2024-11-27 12:21:36 +01:00
Azgaar
5ac99d180d chore: parse DEBUG setting as an object 2024-10-22 14:45:25 +02:00
Azgaar
8a4f28b321 fix: CRLF issue 2024-10-19 13:32:59 +02:00
Azgaar
56597d961d fix: remove unwanted states styling 2024-10-03 13:05:10 +02:00
Azgaar
2d0030e3d4 feat: allow to crean data in case of load error 2024-10-01 21:20:29 +02:00
Azgaar
949a486bf8 fix: redraw features on load 2024-09-25 13:18:22 +02:00
Azgaar
861b219e6e fix: don't hide armies layer 2024-09-21 14:23:18 +02:00
Azgaar
1a61a433b7 fix: loose format requirements for old files to show correct message 2024-09-21 13:58:11 +02:00
Azgaar
62805dc1a6 fix: slow load 2024-09-21 01:16:28 +02:00
Azgaar
18b9f604e9 fix: #1136 2024-09-21 00:33:24 +02:00
Azgaar
5904e9e7c6 fix: routes (v1.104.3) 2024-09-20 14:16:07 +02:00
Azgaar
05de284e02
Refactor layers rendering (#1120)
* feat: render states - use global fn

* feat: render states - separate pole detection from layer render

* feat: render provinces

* chore: unify drawFillWithGap

* refactor: drawIce

* refactor: drawBorders

* refactor: drawHeightmap

* refactor: drawTemperature

* refactor: drawBiomes

* refactor: drawPrec

* refactor: drawPrecipitation

* refactor: drawPopulation

* refactor: drawCells

* refactor: geColor

* refactor: drawMarkers

* refactor: drawScaleBar

* refactor: drawScaleBar

* refactor: drawMilitary

* refactor: pump version to 1.104.00

* refactor: pump version to 1.104.00

* refactor: drawCoastline and createDefaultRuler

* refactor: drawCoastline

* refactor: Features module start

* refactor: features - define distance fields

* feat: drawFeatures

* feat: drawIce don't hide

* feat: detect coastline - fix issue with border feature

* feat: separate labels rendering from generation process

* feat: auto-update and restore layers

* refactor - change layers

* refactor - sort layers

* fix: regenerate burgs to re-render layers

* fix: getColor is not defined

* fix: burgs overview - don't auto-show labels on hover

* fix: redraw population on change

* refactor: improve tooltip logic for burg labels and icons

* chore: pump version to 1.104.0

* fefactor: edit coastline and lake

* fix: minot fixes

* fix: submap

---------

Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
2024-09-20 12:20:27 +02:00
Azgaar
4c6c5288a1 refactor: load.js formatting 2024-09-06 01:11:25 +02:00
Azgaar
dd35947ecd fix: version detection on load 2024-09-06 00:32:32 +02:00
Azgaar
0b8d3c63fc fix: 1.103.02 - parse old .map - markers data fix 2024-09-04 22:30:24 +02:00
Azgaar
637aa398bb fix: 1.103.01 - parse old .map - add patch version 2024-09-04 22:20:56 +02:00
Azgaar
eb29c5ec5d
Zones generator update (#1113)
* feat: style - store emblem size mod in style (v1.99.10)

* fix the isOutdated function for versions past 1.99

* fix: showUploadMessage function not called correctly for isUpdated case

* feat: load - improve version detection

* feat: improve version detection and update process

* feat: Update version and use constant for VERSION in multiple files

* Update versioning.js to fix incorrect message display for stored version

* feat: zones editor - update to work with pack data

* feat: zones editor - update editor

* feat: zones editor - update editor

* chore: update version

* feat: zones - regenerate

* feat: zones - render zones as continuius line

* feat: zones - editot changes

* feat: zones - auto-update

* feat: zones - generation fixes

* feat: zones - generation fixes

* feat: zones - restore layer

* feat: zones - proselytism - check population

---------

Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
2024-09-01 12:48:39 +02:00
Azgaar
19f7f2508e fix: geoJSON export - fix array level 2024-08-27 14:04:02 +02:00
Azgaar
bf41ad1b70 fix: #1114 - saveGeoJSON_Routes 2024-08-27 12:07:49 +02:00
Azgaar
b54f758350 fix: routes - don't render route with <2 points 2024-08-23 18:26:12 +02:00
Azgaar
d4aef4920c
Slider-input web component (#1109)
* feat: slider-input web component

* feat: slider-input web component - Brush size

* feat: slider-input - statesGrowthRate

* feat: slider-input - units editor

* feat: slider-input - dissalow invalid numbers

* chore: pump version to v1.99.05

* chore: pump version to v1.99.05

---------

Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
2024-08-22 13:35:36 +02:00
Azgaar
21f16296e7 chore: pump version to 1.99.01 to get fixes applied 2024-08-15 17:23:49 +02:00
Azgaar
f19b891421
Urquhart routes (#1072)
* feat: routes generation

* feat: routes rendering

* feat: searoutes fix, changing reGraph

* feat: searoute - change pathfinding algo

* feat: routes - cleanup code

* feat: routes - change data format

* feat: routes - add routes to json export

* feat: edit routes - start

* feat: edit routes - main

* feat: edit routes - EP

* feat: edit routes - remove route

* feat: route - generate names

* feat: route - continue

* Refactor route merging logic for improved performance

* feat: routes - show name in tooltip

* feat: routes - create route dialog

* feat: update data on control point remove

* feat: routes editor - split route

* feat: add join route functionality to routes editor

* feat: Add join route functionality to routes editor

* feat: Update join route tooltip in routes editor

* feat: routes overview - sort by length

* feat: routes overview - fix distanceScale value

* feat: routes overview - create route

* Refactor getMiddlePoint function to getCloseToEdgePoint

* feat: routes - change data format, fix issues

* feat: routes - regenerateRoutes

* feat: routes - add route on burg creation

* chore - remove merge conflict markers

* chore - remove merge conflict markers

* feat: routes name - no unnamed burg names

* feat: routes - lock routes

* fix: routes - split routes

* feat: routes - tip correction

* feat: routes - auto-update part 1

* feat: routes - return old rePacj logic to not break auto-update

* feat: routes - auto-update - add connections

---------

Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
2024-08-15 15:46:55 +02:00
Azgaar
b267e832b5 fix: support migration of v0.9 maps 2024-07-30 17:54:17 +02:00
Azgaar
00abd5213b fix: #1103 2024-07-27 14:32:42 +02:00
Azgaar
e9ee6967ba
Сonfigurable longitude (#1095)
* feat: configurable longitude

* chore: update version

---------

Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
2024-07-12 12:26:03 +02:00
Azgaar
fc7ef72628 feat: Update compass layer and rose element id for v1.98.00 2024-07-07 18:40:04 +02:00
Azgaar
af927ed345 fix: check scheme before setting 2024-03-24 17:53:00 +01:00
Azgaar
7f587400ec feat: improve tiles export UX 2024-03-17 02:03:56 +01:00