Skip to content

Commit

Permalink
navigation stop should properly position the map
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell committed Aug 13, 2023
1 parent b90f2aa commit 2d60c3d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/stores/MapActionReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ export default class MapActionReceiver implements ActionReceiver {
if (this.zoomCtrl !== null) this.map.getControls().insertAt(0, this.zoomCtrl)
if (this.attributionCtrl !== null) this.map.getControls().insertAt(0, this.attributionCtrl)

this.map.getView().animate({ rotation: 0, zoom: 16, duration: 600 })
// reset padding
// somehow the animate call is cancelled => use the setters instead
// this.map.getView().animate({ zoom: 16, rotation: 0, duration: 300 })
this.map.getView().setRotation(0)
this.map.getView().setZoom(16)
const center = this.map.getView().getCenter()

// reset padding requires moving the center again
this.map.getView().padding = [0, 0, 0, 0]
this.map.getView().setCenter(center)

this.map.getView().setConstrainResolution(true)
this.map.un('pointerdrag', this.onMove)
// this.map.getView().un('change:resolution', this.onMove)
Expand Down

0 comments on commit 2d60c3d

Please sign in to comment.