I have a hex polygon (for a game display on a webpage), I have these polygons displaying on a webpage in a big pattern to create a map. Inside some of these hex polygons I hope to include an icon (mountains, hills, etc).
I can easily position the hex using points and I do this with php. However, the paths in the same svg image do not position with the polygon as its points change. Is there a way to keep the paths location relative to a polygon or group everything by points?
What I get now is the SVG only renders on the same spot over and over despite the polygon getting new points for each svg. Here is the URL as a demo, the upper left corner just keep stacking the "mountain" icon, and you can see the holes in the map where it should be placing the "mountain" icons.
To me this makes sense, since the ONLY numbers changing in my above SVG are the <polygon> points....the paths remain the same each time, thus simply overlapping over and over...so I'm trying to find out how to move the paths along with the polygon when the points change...
Greetings,
I have a hex polygon (for a game display on a webpage), I have these polygons displaying on a webpage in a big pattern to create a map. Inside some of these hex polygons I hope to include an icon (mountains, hills, etc).
I can easily position the hex using points and I do this with php. However, the paths in the same svg image do not position with the polygon as its points change. Is there a way to keep the paths location relative to a polygon or group everything by points?
code sample:
Thanks
In the browser, the group element should always collapse to the minimum bounding box of the polygon it contains.
One way would be to have every polygon in the map with identical points stacked at 0,0
Do the points calculation as normal, use that to find the bounding box coordinates which would correspond with those points.
Then translate the group - all points of the polygons would be unaffected.
What I get now is the SVG only renders on the same spot over and over despite the polygon getting new points for each svg. Here is the URL as a demo, the upper left corner just keep stacking the "mountain" icon, and you can see the holes in the map where it should be placing the "mountain" icons.
http://www.noxgeo.com/traveller/galaxy/worldgen/test.php
To me this makes sense, since the ONLY numbers changing in my above SVG are the <polygon> points....the paths remain the same each time, thus simply overlapping over and over...so I'm trying to find out how to move the paths along with the polygon when the points change...