forked from MapComplete/MapComplete
UX: fix #1805, disable zoom-in and zoom-out buttons when maxrange reached
This commit is contained in:
parent
346f45cff8
commit
48159b25f7
13 changed files with 202 additions and 184 deletions
|
@ -118,7 +118,8 @@
|
|||
let viewport: UIEventSource<HTMLDivElement> = new UIEventSource<HTMLDivElement>(undefined)
|
||||
let mapproperties: MapProperties = state.mapProperties
|
||||
state.mapProperties.installCustomKeyboardHandler(viewport)
|
||||
|
||||
let canZoomIn = mapproperties.maxzoom.map(mz => mapproperties.zoom.data < mz, [mapproperties.zoom] )
|
||||
let canZoomOut = mapproperties.minzoom.map(mz => mapproperties.zoom.data > mz, [mapproperties.zoom] )
|
||||
function updateViewport() {
|
||||
const rect = viewport.data?.getBoundingClientRect()
|
||||
if (!rect) {
|
||||
|
@ -329,12 +330,14 @@
|
|||
</If>
|
||||
<MapControlButton
|
||||
arialabel={Translations.t.general.labels.zoomIn}
|
||||
enabled={canZoomIn}
|
||||
on:click={() => mapproperties.zoom.update((z) => z + 1)}
|
||||
on:keydown={forwardEventToMap}
|
||||
>
|
||||
<Plus class="h-8 w-8" />
|
||||
</MapControlButton>
|
||||
<MapControlButton
|
||||
enabled={canZoomOut}
|
||||
arialabel={Translations.t.general.labels.zoomOut}
|
||||
on:click={() => mapproperties.zoom.update((z) => z - 1)}
|
||||
on:keydown={forwardEventToMap}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue