Skip to content

Commit b830462

Browse files
committed
[AUTO] Sync MapML Build
1 parent d12e3d5 commit b830462

File tree

1 file changed

+59
-58
lines changed

1 file changed

+59
-58
lines changed

dist/mapml.js

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,6 +3696,10 @@
36963696
text:"Toggle Debug Mode (<kbd>D</kbd>)",
36973697
callback:this._toggleDebug,
36983698
},
3699+
{
3700+
text:"Copy MapML (<kbd>M</kbd>)",
3701+
callback:this._copyMapML,
3702+
},
36993703
{
37003704
text:"View Map Source (<kbd>V</kbd>)",
37013705
callback:this._viewSource,
@@ -3740,6 +3744,7 @@
37403744

37413745
this._items[6].el = this._createItem(this._container, this._items[6]);
37423746
this._items[7].el = this._createItem(this._container, this._items[7]);
3747+
this._items[8].el = this._createItem(this._container, this._items[8]);
37433748

37443749
this._layerMenu = L.DomUtil.create("div", "mapml-contextmenu mapml-layer-menu", map._container);
37453750
this._layerMenu.style.zIndex = 10001;
@@ -3802,9 +3807,7 @@
38023807
tL = layerElem.extent.topLeft.pcrs,
38033808
bR = layerElem.extent.bottomRight.pcrs;
38043809

3805-
let data = `top-left-easting,${tL.horizontal}\ntop-left-northing,${tL.vertical}\n`;
3806-
data += `bottom-right-easting,${bR.horizontal}\nbottom-right-northing,${bR.vertical}`;
3807-
3810+
let data = `<meta name="extent" content="top-left-easting,${tL.horizontal}, top-left-northing,${tL.vertical}, bottom-right-easting,${bR.horizontal}, bottom-right-northing,${bR.vertical}">`;
38083811
context._copyData(data);
38093812
},
38103813

@@ -3833,6 +3836,12 @@
38333836
mapEl._toggleControls();
38343837
},
38353838

3839+
_copyMapML: function(e){
3840+
let context = e instanceof KeyboardEvent ? this._map.contextMenu : this.contextMenu,
3841+
mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
3842+
context._copyData(mapEl.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm, ""));
3843+
},
3844+
38363845
_viewSource: function(e){
38373846
let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
38383847
mapEl.viewSource();
@@ -4074,6 +4083,7 @@
40744083
this._coordMenu.style.display = 'none';
40754084
this._layerMenu.style.display = 'none';
40764085
this._map.fire('contextmenu.hide', {contextmenu: this});
4086+
setTimeout(() => this._map._container.focus(), 0);
40774087
}
40784088
},
40794089

@@ -4129,64 +4139,55 @@
41294139
return size;
41304140
},
41314141

4132-
_debounceKeyDown: function(func, wait, immediate) {
4133-
let timeout;
4134-
let context = this, args = arguments;
4135-
clearTimeout(timeout);
4136-
timeout = setTimeout(function() {
4137-
timeout = null;
4138-
if (!immediate) func.apply(context, args);
4139-
}, wait);
4140-
if (immediate && !timeout) func.apply(context, args);
4141-
},
4142-
41434142
_onKeyDown: function (e) {
41444143
if(!this._mapMenuVisible) return;
4145-
this._debounceKeyDown(function(){
4146-
let key = e.keyCode;
4147-
if(key !== 16 && key!== 9 && !(!this._layerClicked && key === 67) && e.path[0].innerText !== "Copy Coordinates (C) >")
4144+
4145+
let key = e.keyCode;
4146+
if(key !== 16 && key!== 9 && !(!this._layerClicked && key === 67) && e.path[0].innerText !== "Copy Coordinates (C) >")
4147+
this._hide();
4148+
switch(key){
4149+
case 32: //SPACE KEY
4150+
if(this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu"))
4151+
this._map._container.parentNode.activeElement.click();
4152+
break;
4153+
case 66: //B KEY
4154+
this._goBack(e);
4155+
break;
4156+
case 67: //C KEY
4157+
if(this._layerClicked){
4158+
this._copyLayerExtent(e);
4159+
} else {
4160+
this._copyCoords({
4161+
latlng:this._map.getCenter()
4162+
});
4163+
}
4164+
break;
4165+
case 68: //D KEY
4166+
this._toggleDebug(e);
4167+
break;
4168+
case 77: //M KEY
4169+
this._copyMapML(e);
4170+
break;
4171+
case 70: //F KEY
4172+
this._goForward(e);
4173+
break;
4174+
case 82: //R KEY
4175+
this._reload(e);
4176+
break;
4177+
case 84: //T KEY
4178+
this._toggleControls(e);
4179+
break;
4180+
case 86: //V KEY
4181+
this._viewSource(e);
4182+
break;
4183+
case 27: //H KEY
41484184
this._hide();
4149-
switch(key){
4150-
case 32: //SPACE KEY
4151-
if(this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu"))
4152-
this._map._container.parentNode.activeElement.click();
4153-
break;
4154-
case 66: //B KEY
4155-
this._goBack(e);
4156-
break;
4157-
case 67: //C KEY
4158-
if(this._layerClicked){
4159-
this._copyLayerExtent(e);
4160-
} else {
4161-
this._copyCoords({
4162-
latlng:this._map.getCenter()
4163-
});
4164-
}
4165-
break;
4166-
case 68:
4167-
this._toggleDebug(e);
4168-
break;
4169-
case 70:
4170-
this._goForward(e);
4171-
break;
4172-
case 82: //R KEY
4173-
this._reload(e);
4174-
break;
4175-
case 84: //T KEY
4176-
this._toggleControls(e);
4177-
break;
4178-
case 86: //V KEY
4179-
this._viewSource(e);
4180-
break;
4181-
case 27: //H KEY
4182-
this._hide();
4183-
break;
4184-
case 90: //Z KEY
4185-
if(this._layerClicked)
4186-
this._zoomToLayer(e);
4187-
break;
4188-
}
4189-
},250);
4185+
break;
4186+
case 90: //Z KEY
4187+
if(this._layerClicked)
4188+
this._zoomToLayer(e);
4189+
break;
4190+
}
41904191
},
41914192

41924193
_showCoordMenu: function(e){

0 commit comments

Comments
 (0)