From cff3473fa635cca27d273c26c9371d65785980e9 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Fri, 9 Dec 2022 08:11:01 +0000 Subject: [PATCH] Fix marker icon sizes --- plugins/tiddlywiki/geospatial/widgets/geomap.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/tiddlywiki/geospatial/widgets/geomap.js b/plugins/tiddlywiki/geospatial/widgets/geomap.js index 8da575fe9..8eda39da8 100644 --- a/plugins/tiddlywiki/geospatial/widgets/geomap.js +++ b/plugins/tiddlywiki/geospatial/widgets/geomap.js @@ -56,12 +56,13 @@ GeomapWidget.prototype.renderMap = function(domNode) { attribution: '© OpenStreetMap' }).addTo(map); // Create default icon + const iconProportions = 365/560, + iconHeight = 50; const myIcon = new L.Icon({ iconUrl: $tw.utils.makeDataUri(this.wiki.getTiddlerText("$:/plugins/tiddlywiki/geospatial/images/markers/pin"),"image/svg+xml"), - iconSize: [38, 95], - shadowSize: [50, 64], - iconAnchor: [22, 94], - popupAnchor: [-3, -76] + iconSize: [iconHeight * iconProportions, iconHeight], // Side of the icon + iconAnchor: [(iconHeight * iconProportions) / 2, iconHeight], // Position of the anchor within the icon + popupAnchor: [0, -iconHeight] // Position of the popup anchor relative to the icon anchor }); // Add scale L.control.scale().addTo(map);