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