Skip to content

Commit d4ebb07

Browse files
committed
[AUTO] Sync MapML Build
1 parent dc355ae commit d4ebb07

File tree

1 file changed

+36
-16
lines changed

1 file changed

+36
-16
lines changed

dist/mapml.js

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,20 @@
277277
// must have leaflet-pane class because of new/changed rule in leaflet.css
278278
// info: https://github.com/Leaflet/Leaflet/pull/4597
279279
L.DomUtil.addClass(this._container,'leaflet-pane mapml-vector-container');
280+
281+
let anim = L.DomUtil.create("style", "mapml-feature-animation", this._container);
282+
anim.innerHTML = `@keyframes pathSelect {
283+
0% {stroke: white;}
284+
50% {stroke: black;}
285+
}
286+
287+
.mapml-path-selected {
288+
animation-name: pathSelect;
289+
animation-duration: 1s;
290+
stroke-width: 5;
291+
stroke: black;
292+
}`;
293+
280294
L.setOptions(this.options.renderer, {pane: this._container});
281295
this._layers = {};
282296
if(this.options.query){
@@ -325,6 +339,7 @@
325339
if(this._staticFeature){
326340
return {
327341
'moveend':this._handleMoveEnd,
342+
'zoomend' : this._handleZoomEnd,
328343
};
329344
}
330345
return {
@@ -341,20 +356,20 @@
341356
} else {
342357
path._path.removeAttribute("tabindex");
343358
}
344-
if(path._path.childElementCount === 0) {
345-
let title = L.SVG.create("title");
346-
title.innerHTML = path.accessibleTitle;
347-
path._path.appendChild(title);
348-
}
359+
path._path.setAttribute("aria-label", path.accessibleTitle);
349360
path._path.setAttribute("aria-expanded", "false");
350361
/* jshint ignore:start */
351362
L.DomEvent.on(path._path, "keyup keydown", (e)=>{
352363
if((e.keyCode === 9 || e.keyCode === 16 || e.keyCode === 13) && e.type === "keyup"){
364+
path._path.classList.add("mapml-path-selected");
353365
path.openTooltip();
354366
} else {
367+
path._path.classList.remove("mapml-path-selected");
355368
path.closeTooltip();
356369
}
357370
});
371+
path._path.classList.remove("mapml-path-selected");
372+
if(path.isTooltipOpen())path.closeTooltip();
358373
/* jshint ignore:end */
359374
}
360375
}
@@ -418,21 +433,25 @@
418433
},
419434

420435
_handleMoveEnd : function(){
436+
let mapZoom = this._map.getZoom(),
437+
withinZoom = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom;
438+
this.isVisible = withinZoom && this._layers && this.layerBounds &&
439+
this.layerBounds.overlaps(
440+
M.pixelToPCRSBounds(
441+
this._map.getPixelBounds(),
442+
mapZoom,this._map.options.projection));
443+
this._removeCSS();
444+
this._updateTabIndex();
445+
},
446+
447+
_handleZoomEnd: function(e){
421448
let mapZoom = this._map.getZoom();
422449
if(mapZoom > this.zoomBounds.maxZoom || mapZoom < this.zoomBounds.minZoom){
423450
this.clearLayers();
424-
this.isVisible = false;
425451
return;
426452
}
427453
let clampZoom = this._clampZoom(mapZoom);
428454
this._resetFeatures(clampZoom);
429-
this.isVisible = this._layers && this.layerBounds &&
430-
this.layerBounds.overlaps(
431-
M.pixelToPCRSBounds(
432-
this._map.getPixelBounds(),
433-
mapZoom,this._map.options.projection));
434-
this._removeCSS();
435-
this._updateTabIndex();
436455
},
437456

438457
//sets default if any are missing, better to only replace ones that are missing
@@ -627,6 +646,7 @@
627646
_removeCSS: function(){
628647
let toDelete = this._container.querySelectorAll("link[rel=stylesheet],style");
629648
for(let i = 0; i < toDelete.length;i++){
649+
if(toDelete[i].classList.contains("mapml-feature-animation")) continue;
630650
this._container.removeChild(toDelete[i]);
631651
}
632652
},
@@ -2365,7 +2385,7 @@
23652385
var c = document.createElement('div');
23662386
c.classList.add("mapml-popup-content");
23672387
c.insertAdjacentHTML('afterbegin', properties.innerHTML);
2368-
geometry.bindPopup(c, {autoPan:false, minWidth: 108});
2388+
geometry.bindPopup(c, {autoClose: false, minWidth: 108});
23692389
}
23702390
}
23712391
});
@@ -2395,7 +2415,7 @@
23952415
var c = document.createElement('div');
23962416
c.classList.add("mapml-popup-content");
23972417
c.insertAdjacentHTML('afterbegin', properties.innerHTML);
2398-
geometry.bindPopup(c, {autoPan:false, minWidth: 108});
2418+
geometry.bindPopup(c, {autoClose: false, minWidth: 108});
23992419
}
24002420
}
24012421
}).addTo(map);
@@ -3875,7 +3895,7 @@
38753895
crs = layer.crs,
38763896
tileSize = map.options.crs.options.crs.tile.bounds.max.x,
38773897
container = layer._container,
3878-
popupOptions = {autoPan: true, maxHeight: (map.getSize().y * 0.5) - 50},
3898+
popupOptions = {autoClose: false, autoPan: true, maxHeight: (map.getSize().y * 0.5) - 50},
38793899
tcrs2pcrs = function (c) {
38803900
return crs.transformation.untransform(c,crs.scale(zoom));
38813901
},

0 commit comments

Comments
 (0)