fix: remove cooperativeGestures, increase fitBounds padding, add popups to embedded maps
This commit is contained in:
@@ -44,8 +44,7 @@ var feedMap = new maplibregl.Map({
|
||||
container: 'feed-map',
|
||||
style: MapUtils.MAP_STYLE,
|
||||
center: [20, 20],
|
||||
zoom: 2,
|
||||
cooperativeGestures: true
|
||||
zoom: 2
|
||||
});
|
||||
|
||||
feedMap.on('load', function () {
|
||||
@@ -59,11 +58,10 @@ feedMap.on('load', function () {
|
||||
bounds.extend(lngLat);
|
||||
|
||||
var el = MapUtils.createDotMarker(isLatest);
|
||||
el.addEventListener('click', function () {
|
||||
window.location.href = entry.url;
|
||||
});
|
||||
var popup = new maplibregl.Popup({ offset: 12, closeButton: false, maxWidth: '200px' })
|
||||
.setHTML('<div style="font-family:var(--font-ui);"><div style="font-size:0.72rem;color:var(--color-ink-muted);margin-bottom:2px;">' + entry.date + '</div><div style="font-weight:600;font-size:0.88rem;color:var(--color-ink);margin-bottom:6px;">' + entry.title + '</div><a href="' + entry.url + '" style="color:var(--color-accent);font-size:0.82rem;text-decoration:none;">Read →</a></div>');
|
||||
|
||||
new maplibregl.Marker({ element: el }).setLngLat(lngLat).addTo(feedMap);
|
||||
new maplibregl.Marker({ element: el }).setLngLat(lngLat).setPopup(popup).addTo(feedMap);
|
||||
});
|
||||
|
||||
MapUtils.addJourneyLine(feedMap, coords, 'feed-journey');
|
||||
@@ -71,7 +69,7 @@ feedMap.on('load', function () {
|
||||
if (FEED_ENTRIES.length === 1) {
|
||||
feedMap.jumpTo({ center: coords[0], zoom: 10 });
|
||||
} else {
|
||||
feedMap.fitBounds(bounds, { padding: 20, maxZoom: 11 });
|
||||
feedMap.fitBounds(bounds, { padding: 60, maxZoom: 11 });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user