Skip to content

Commit

Permalink
update keydown event listener and fix query handler bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AliyanH committed Jan 24, 2023
1 parent 6aa6494 commit f81681f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/mapml-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,16 +347,17 @@ export class MapViewer extends HTMLElement {
}
});
// pasting layer-, links and geojson using Ctrl+V
this.parentElement.addEventListener('keydown', function (e) {
if(e.keyCode === 86 && e.ctrlKey && document.activeElement.nodeName === "MAPML-VIEWER"){
this.addEventListener('keydown', function (e) {
if(e.keyCode === 86 && e.ctrlKey){
navigator.clipboard
.readText()
.then(
(layer) => {
M._pasteLayer(document.activeElement, layer);
M._pasteLayer(this, layer);
});
} else if (e.keyCode === 32 && document.activeElement.nodeName === "MAPML-VIEWER") {
} else if (e.keyCode === 32) {
e.preventDefault();
this._map.fire('keypress', {originalEvent: e});
}});
this.parentElement.addEventListener('mousedown', function (e) {
if(document.activeElement.nodeName === "MAPML-VIEWER"){
Expand Down

0 comments on commit f81681f

Please sign in to comment.