From 76962031594ddbbe54583a12692967885d78d830 Mon Sep 17 00:00:00 2001 From: Joachim Schleicher Date: Thu, 5 Oct 2023 20:57:53 +0200 Subject: [PATCH] highlight selected path when opening a popup increase opacity and weight. In maps with multiple lines one can see much easier, where the line starts and ends. --- umap/static/umap/js/umap.features.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index 7de50be8..6f13e777 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -816,6 +816,20 @@ L.U.PathMixin = { L.U.FeatureMixin.endEdit.call(this) }, + highlightPath: function () { + this.parentClass.prototype.setStyle.call(this, { + opacity: 1.0, + weight: 1.3 * this.getDynamicOption('weight'), + }) + }, + + resetPath: function () { + this.parentClass.prototype.setStyle.call(this, { + opacity: this.getDynamicOption('opacity'), + weight: this.getDynamicOption('weight'), + }) + }, + _onMouseOver: function () { if (this.map.measureTools && this.map.measureTools.enabled()) { this.map.ui.tooltip({ content: this.getMeasure(), anchor: this }) @@ -829,6 +843,8 @@ L.U.PathMixin = { this.on('mouseover', this._onMouseOver) this.on('edit', this.makeDirty) this.on('drag editable:drag', this._onDrag) + this.on('popupopen', this.highlightPath) + this.on('popupclose', this.resetPath) }, _onDrag: function () {