Added the ability to swap even and odd positions. With flat top hexes, for a hex (x, y), (x+1, y) is to the to the southeast if x is odd and to the northeast if x is even. Adding option swap-even-odd will reverse this: (x+1, y) is to the to the southeast if x is even and to the northeast if x is odd. This swapped numbering scheme is compatible with maps like the one for Wolves Upon the Coast.
Added support for very simple coordinate formatting. Use option coordinates-format.
The formatter will replace {X} with the x value and {Y} with the Y value.
EXAMPLE: To render (4, 5) as 04.05, use option coordinates-format {X}.{Y}.
Namespaced all element IDs: HTML/SVG assumes that a DOM element id is unique. Prior to this change, we did not ensure unique IDs, which led to issues when there was more than one map in the same document.
You can turn off namespacing by using option global.
Tests
Swap Even Odd
Depending on the hex program you use, you might get different numbering scheme. Here's the source (a section of "Wolves Upon the Coast" by Luke Gearing). You can see here that for an odd X hex like 01.04, the next hex to the right with the same Y value 02.04 is to the northeast
Before
If I put the hex numbers into the textmapper plugin, 0204 is rendered to the southeast of 0104
After
Adding option swap-even-odd fixes the alignment of hexes, producing something that looks more like the source material:
Coordinate Formatting
Here's the above map with option coordinates format {X}.{Y}. Now the map really matches the source material:
Namespacing
Before
Both these maps have option global set. Notice how the pointy top hexes used in the top map (which has option horizontal set) carry over to the bottom map:
After
Now the Obsidian document ID is appended to every ID in the map, and every SVG element is unique to the map.
What it is
option swap-even-odd
will reverse this: (x+1, y) is to the to the southeast if x is even and to the northeast if x is odd. This swapped numbering scheme is compatible with maps like the one for Wolves Upon the Coast.option coordinates-format
.{X}
with the x value and{Y}
with the Y value.04.05
, useoption coordinates-format {X}.{Y}
.id
is unique. Prior to this change, we did not ensure unique IDs, which led to issues when there was more than one map in the same document.option global
.Tests
Swap Even Odd
Depending on the hex program you use, you might get different numbering scheme. Here's the source (a section of "Wolves Upon the Coast" by Luke Gearing). You can see here that for an odd X hex like 01.04, the next hex to the right with the same Y value 02.04 is to the northeast
Before
If I put the hex numbers into the textmapper plugin, 0204 is rendered to the southeast of 0104
After
Adding
option swap-even-odd
fixes the alignment of hexes, producing something that looks more like the source material:Coordinate Formatting
Here's the above map with
option coordinates format {X}.{Y}
. Now the map really matches the source material:Namespacing
Before
Both these maps have
option global
set. Notice how the pointy top hexes used in the top map (which hasoption horizontal
set) carry over to the bottom map:After
Now the Obsidian document ID is appended to every ID in the map, and every SVG element is unique to the map.