diff --git a/umap/static/umap/img/target.svg b/umap/static/umap/img/target.svg new file mode 100644 index 00000000..d7b58538 --- /dev/null +++ b/umap/static/umap/img/target.svg @@ -0,0 +1 @@ + diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 7a35cde6..3aee1cf2 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -468,6 +468,20 @@ U.Search = L.PhotonSearch.extend({ }) el.appendChild(tools) this._formatResult(feature, el) + const path = U.SCHEMA.iconUrl.default.replace('marker.svg', 'target.svg') + const icon = L.icon({ + iconUrl: path, + iconSize: [24, 24], + iconAnchor: [12, 12], + }) + const coords = feature.geometry.coordinates + const target = L.marker([coords[1], coords[0]], { icon }) + el.addEventListener('mouseover', (event) => { + target.addTo(this.map) + }) + el.addEventListener('mouseout', (event) => { + target.removeFrom(this.map) + }) }, setChoice: function (choice) {