Commit Graph

13 Commits

Author SHA1 Message Date
jordi fita mas 8d49857dae Add a polygon around each accommodation on the public map
I can not use <a> in that map because Leaflet handles the mouse over
before the anchors sees it, thus it is impossible to click on them; i
have to use a Leaflet layer.

Fortunately, i can just use the <path>’s coordinates as
the polygon points, because with CRS.Simple the coordinates map to
pixel, except for the reversed Y/latitude coordinate. Unfortunately,
<path> coordinates are not straightforward to get: I have to follow the
drawing coordinates, taking into account the current transformation
(CTM), and keeping the last point around for relative coordinates.
Bézier curves are simplified to a straight line from start to end.

There is one single accommodation that started with a relative move
command (m), which apparently have to be treated as an absolute
move (M), but subsequent pairs are treated as relative coordinates[0].

It was easier for me to convert that relative move to absolute and add
a relative lineto command (l) to the next pair.

For now, all i do is highlight the accommodation and zoom it on click,
because i do not know how i should the accommodation’s information.

[0]: https://www.w3.org/TR/SVG11/paths.html#PathDataMovetoCommands
2024-01-25 04:28:51 +01:00
jordi fita mas 623f0af2ab Fill the immediate path inside map’s anchors, and remove one extra group
In the map i added in e3503187d, paths around each accommodation
inherited the fill and stroke from the group, thus i could just override
that fill at the anchor level, but the current map sets the fill to each
accommodation’s path, party because the text is not a path too, partly
because Affinity is a visual tool only and does not give a shit about
mark up.

If we keep the text in a group, however, we can set the fill of the area
using CSS too, although it is not nice due to `!important`, but still.
There was a plot, however, #93, that had the area in a group too, and
i had to remove that group manually.
2024-01-25 01:26:02 +01:00
jordi fita mas 9053f7ce92 Put back cp_ prefix for map’s accommodations and hide trees and zones
It seems that the prefix got removed in one of the edits.

Also, Affinity does not give a fuck to what classes we give to the
elements, and just removes them, thus .guest-only no longer matches, and
had to hide the layers by id.  Hope they hold this time.
2024-01-24 14:42:47 +01:00
jordi fita mas 81b6edbc7b Show campground map using leaflet
It is better for mobile users, as they can zoom and pan the map in their
small screens.

Had to increase header’s z-index or the zoom controls would be on top
of it.
2024-01-14 22:31:13 +01:00
oriol carbonell pujolàs cb97151264 Update campground map 2024-01-14 21:36:03 +01:00
oriol carbonell pujolàs c555ecd432 Update campground map 2023-12-21 11:59:01 +01:00
oriol carbonell pujolàs ed099ad19f Update campground map 2023-12-20 13:02:41 +01:00
oriol carbonell pujolàs 6e1d5b14bc Style changes 2023-12-13 23:23:28 +01:00
oriol carbonell pujolàs 97dc93d06d Update web/templates/campground_map.svg 2023-09-26 05:50:00 +00:00
jordi fita mas 9dfa210708 Replace gradient image for trees in SVG with an actual SVG gradient 2023-09-25 18:03:05 +02:00
jordi fita mas 819c0412d2 Add missing campsites and mark them on the SVG map 2023-09-25 12:51:11 +02:00
jordi fita mas bba555be10 Replace SVG’s foreign attribute with a specific prefix for IDs
I decided to use a custom attribute for the campsite label in the SVG
because i was a bit wary of reusing ‘id’ for that, specially given that
most labels are number only and XML can not have IDs starting with a
number.

In fact, at least Inkscape and Affinity solve the problem by having an
additional foreign attribute to keep the “group label” in without that
restriction (‘inkscape:label’ and ‘serif:id’, respectively), thus i
thought of doing the same, but with a namespace that i control and be
independent of the design program.

However, it seems that Affinity does not have a way of editing the XML
attributes like Inkscape does[0], thus there is no way of adding or
editing that value from there; i can not ask Oriol to edit the SVG file
in a text editor each time.

We have agreed to reuse the ‘id’ attribute to contain the campsite’s
label by using a specific prefix, that we checked is editable without
issue in Affinity’s UI.

[0]: https://forum.affinity.serif.com/index.php?/topic/24318-xml-data/&do=findComment&comment=115609
2023-09-25 12:44:47 +02:00
jordi fita mas 6d84b8baad Fix campground and campsite nomenclature for SVG map
I am using the US terms for campground and campsite, that’s why the
relation is called ‘campsite’ instead of ‘pitch’, but i used the wrong
terminology in the SVG map because the customer uses the UK term and
call themselves campsite, so i mixed things.

It is now the campground map and each individual area is a campsite,
as i have been using all along.
2023-09-25 12:34:05 +02:00