layouts: map: Add option to make map non-resizable

This commit is contained in:
Martin Rubli
2023-10-23 23:37:45 +02:00
parent e5da3c0bd8
commit 440f144cb9

View File

@@ -2,7 +2,7 @@
Syntax summary:
{{< leaflet-map centerLat=FLOAT centerLon=FLOAT zoom=INT width="STRING" height="STRING" >}}
{{< leaflet-map centerLat=FLOAT centerLon=FLOAT zoom=INT width="STRING" height="STRING" resizable=BOOL >}}
{{< leaflet-layer id="STRING" apiKey="STRING" >}}
@@ -28,6 +28,9 @@ Map options:
height:
Height of the map, including CSS units (e.g. "50%", "300px").
Optional, defaults to "50vh".
resizable:
Boolean value indicating whether the map should be drag & drop resizable.
Optional, defaults to true.
Layer options:
@@ -144,11 +147,13 @@ Elevation profile options:
// Create the map
var map = Quip.createTrackMap(map_options_{{ $uniqueId }});
{{ if .Get "resizable" | default "true" }}
// Make the map resizable
$('#map_container_{{ $uniqueId }}').resizable({
handles: 'e, s, se',
resize: () => map.invalidateSize(),
});
{{ end }}
// Move the Leaflet attribution out of the map container
$('#map_attribution_{{ $uniqueId }}').append(