UX+Accessibility: focus on map when appropriate
This commit is contained in:
parent
3a915bdf25
commit
bb328d9724
3 changed files with 25 additions and 2 deletions
|
@ -345,11 +345,25 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
||||||
this.drawSpecialLayers()
|
this.drawSpecialLayers()
|
||||||
this.initHotkeys()
|
this.initHotkeys()
|
||||||
this.miscSetup()
|
this.miscSetup()
|
||||||
|
this.focusOnMap()
|
||||||
if (!Utils.runningFromConsole) {
|
if (!Utils.runningFromConsole) {
|
||||||
console.log("State setup completed", this)
|
console.log("State setup completed", this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* By focussing on the map, the keyboard panning and zoom with '+' and '+' works */
|
||||||
|
public focusOnMap() {
|
||||||
|
if (this.map.data) {
|
||||||
|
this.map.data.getCanvas().focus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.map.addCallbackAndRunD((map) => {
|
||||||
|
map.on("load", () => {
|
||||||
|
map.getCanvas().focus()
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
public showNormalDataOn(map: Store<MlMap>): ReadonlyMap<string, FilteringFeatureSource> {
|
public showNormalDataOn(map: Store<MlMap>): ReadonlyMap<string, FilteringFeatureSource> {
|
||||||
const filteringFeatureSource = new Map<string, FilteringFeatureSource>()
|
const filteringFeatureSource = new Map<string, FilteringFeatureSource>()
|
||||||
this.perLayer.forEach((fs, layerName) => {
|
this.perLayer.forEach((fs, layerName) => {
|
||||||
|
@ -417,6 +431,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
||||||
() => {
|
() => {
|
||||||
this.selectedElement.setData(undefined)
|
this.selectedElement.setData(undefined)
|
||||||
this.guistate.closeAll()
|
this.guistate.closeAll()
|
||||||
|
this.focusOnMap()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -626,8 +641,16 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
||||||
// We did _unselect_ an item - we always remove the lastclick-object
|
// We did _unselect_ an item - we always remove the lastclick-object
|
||||||
this.lastClickObject.features.setData([])
|
this.lastClickObject.features.setData([])
|
||||||
this.selectedLayer.setData(undefined)
|
this.selectedLayer.setData(undefined)
|
||||||
|
this.focusOnMap()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.guistate.allToggles.forEach((toggle) => {
|
||||||
|
toggle.toggle.addCallbackD((isOpened) => {
|
||||||
|
if (!isOpened) {
|
||||||
|
this.focusOnMap()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
new ThemeViewStateHashActor(this)
|
new ThemeViewStateHashActor(this)
|
||||||
new MetaTagging(this)
|
new MetaTagging(this)
|
||||||
new TitleHandler(this.selectedElement, this.selectedLayer, this.featureProperties, this)
|
new TitleHandler(this.selectedElement, this.selectedLayer, this.featureProperties, this)
|
||||||
|
|
|
@ -93,7 +93,7 @@ export default class Hotkeys {
|
||||||
})
|
})
|
||||||
} else if (key["nomod"] !== undefined) {
|
} else if (key["nomod"] !== undefined) {
|
||||||
document.addEventListener(type, function (event) {
|
document.addEventListener(type, function (event) {
|
||||||
if (Hotkeys.textElementSelected(event)) {
|
if (Hotkeys.textElementSelected(event) && keycode !== "Escape") {
|
||||||
// A text element is selected, we don't do anything special
|
// A text element is selected, we don't do anything special
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,7 +370,7 @@
|
||||||
|
|
||||||
<IfHidden condition={state.guistate.backgroundLayerSelectionIsOpened}>
|
<IfHidden condition={state.guistate.backgroundLayerSelectionIsOpened}>
|
||||||
<!-- background layer selector -->
|
<!-- background layer selector -->
|
||||||
<FloatOver
|
<FloatOver
|
||||||
on:close={() => {
|
on:close={() => {
|
||||||
state.guistate.backgroundLayerSelectionIsOpened.setData(false)
|
state.guistate.backgroundLayerSelectionIsOpened.setData(false)
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue