From 04966cc0687e1b337c9fca085094c9eec13bca97 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 11 Feb 2025 15:49:53 +0100 Subject: [PATCH] feat: make the tooltip sticky in hover mode for paths Until now, it was displayed on the path (line or polygon) "center". So when zoomed in, if the center is not on the screen, the tooltip will not be visible. --- umap/static/umap/js/modules/rendering/ui.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/umap/static/umap/js/modules/rendering/ui.js b/umap/static/umap/js/modules/rendering/ui.js index 0320aefa..41fb0e25 100644 --- a/umap/static/umap/js/modules/rendering/ui.js +++ b/umap/static/umap/js/modules/rendering/ui.js @@ -293,6 +293,11 @@ const PathMixin = { this.on('popupclose', this._redraw) }, + bindTooltip: function (content, options) { + options.sticky = !options.permanent + this.parentClass.prototype.bindTooltip.call(this, content, options) + }, + highlightPath: function () { this.parentClass.prototype.setStyle.call(this, { fillOpacity: Math.sqrt(this.feature.getDynamicOption('fillOpacity', 1.0)),