Skip to content

Commit

Permalink
Focus on the feature when activating feature link
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-lu-uw committed Nov 26, 2021
1 parent 3b5eacd commit 2752c04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/mapml/features/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export var Feature = L.Path.extend({
link.visited = true;
elem.setAttribute("stroke", "#6c00a2");
elem.classList.add("map-a-visited");
M.handleLink(link, leafletLayer);
M.handleLink(link, leafletLayer, elem);
}
}
}, this);
Expand All @@ -88,7 +88,7 @@ export var Feature = L.Path.extend({
link.visited = true;
elem.setAttribute("stroke", "#6c00a2");
elem.classList.add("map-a-visited");
M.handleLink(link, leafletLayer);
M.handleLink(link, leafletLayer, elem);
}
}, this);
L.DomEvent.on(elem, 'mouseenter keyup', (e) => {
Expand Down
4 changes: 2 additions & 2 deletions src/mapml/utils/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export var Util = {
this.push(parseFloat(element));
},

handleLink: function (link, leafletLayer) {
handleLink: function (link, leafletLayer, elem) {
let zoomTo, justPan = false, layer, map = leafletLayer._map, opacity;
if(link.type === "text/html" && link.target !== "_blank"){ // all other target values other than blank behave as _top
link.target = "_top";
Expand Down Expand Up @@ -395,7 +395,7 @@ export var Util = {
} else if (zoomTo && !link.inPlace && justPan){
leafletLayer._map.options.mapEl.zoomTo(+zoomTo.lat, +zoomTo.lng, +zoomTo.z);
if(opacity) layer.opacity = opacity;
map.getContainer().focus();
elem.focus();
}
},

Expand Down

0 comments on commit 2752c04

Please sign in to comment.