From 37732b8f169ec58c920c222bdec20735933d1557 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Sun, 16 Jul 2023 11:35:33 +0200 Subject: [PATCH] Fix tooltip anchor not updated anymore according to the direction This is a change in Leaflet 1.7.0 cf https://github.com/Leaflet/Leaflet/issues/7302 --- umap/static/umap/js/umap.features.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index 11c9f7b9..c6903950 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -580,6 +580,20 @@ L.U.Marker = L.Marker.extend({ this.resetTooltip() }, + _getTooltipAnchor: function () { + const anchor = this.options.icon.options.tooltipAnchor, + direction = this.getOption('labelDirection') + if (direction === 'left') { + anchor.x *= -1 + } else if (direction === 'bottom') { + anchor.x = 0 + anchor.y = 0 + } else if (direction === 'top') { + anchor.x = 0 + } + return anchor + }, + disconnectFromDataLayer: function (datalayer) { this.options.icon.datalayer = null L.U.FeatureMixin.disconnectFromDataLayer.call(this, datalayer)