Focus map on Esc
This commit is contained in:
parent
76fb05f0b2
commit
a7ba49c2c2
@ -205,6 +205,8 @@ export default defineComponent({
|
||||
// markerZoomAnimation: false,
|
||||
})) as DynmapMap;
|
||||
|
||||
window.addEventListener('keydown', this.handleKeydown);
|
||||
|
||||
this.leaflet.createPane('vectors');
|
||||
|
||||
this.leaflet.addControl(new LoadingControl({
|
||||
@ -221,7 +223,17 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
|
||||
unmounted() {
|
||||
window.removeEventListener('keydown', this.handleKeydown);
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleKeydown(e: KeyboardEvent) {
|
||||
if(e.key === 'Escape') {
|
||||
e.preventDefault();
|
||||
this.leaflet.getContainer().focus();
|
||||
}
|
||||
},
|
||||
updateFollow(player: DynmapPlayer, newFollow: boolean) {
|
||||
const store = useStore(),
|
||||
followMapName = store.state.configuration.followMap,
|
||||
|
@ -114,7 +114,6 @@ export default defineComponent({
|
||||
const handleEsc = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape" && menuVisible.value) {
|
||||
closeContextMenu();
|
||||
props.leaflet.getContainer().focus();
|
||||
}
|
||||
},
|
||||
closeContextMenu = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user