forked from MapComplete/MapComplete
A11y: add option to disable or always enable a11y features
This commit is contained in:
parent
3059d2ed26
commit
8dd1a0e107
9 changed files with 95 additions and 66 deletions
|
@ -511,15 +511,25 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
|||
await Utils.waitFor(250)
|
||||
}
|
||||
}
|
||||
public installCustomKeyboardHandler(viewport: Store<HTMLDivElement>) {
|
||||
viewport.mapD(
|
||||
public installCustomKeyboardHandler(viewportStore: UIEventSource<HTMLDivElement>) {
|
||||
viewportStore.mapD(
|
||||
(viewport) => {
|
||||
const map = this._maplibreMap.data
|
||||
if (!map) {
|
||||
return
|
||||
}
|
||||
const oldKeyboard = map.keyboard
|
||||
oldKeyboard._panStep = viewport.getBoundingClientRect().width
|
||||
const w = viewport.getBoundingClientRect().width
|
||||
if (w < 10) {
|
||||
/// this is weird, but definitively wrong!
|
||||
console.log("Got a very small bound", w, viewport)
|
||||
// We try again later on
|
||||
window.requestAnimationFrame(() => {
|
||||
viewportStore.ping()
|
||||
})
|
||||
return
|
||||
}
|
||||
oldKeyboard._panStep = w
|
||||
},
|
||||
[this._maplibreMap]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue