map: save bounds on drag end store on resetview
This commit is contained in:
parent
72dccaa51c
commit
ba9cc703d7
|
@ -122,6 +122,7 @@ define(["map/clientlayer", "map/labelslayer",
|
|||
var self = this
|
||||
var barycenter
|
||||
var groupOnline, groupOffline, groupNew, groupLost, groupLines
|
||||
var savedBounds
|
||||
|
||||
var map, userLocation
|
||||
var layerControl
|
||||
|
@ -134,6 +135,10 @@ define(["map/clientlayer", "map/labelslayer",
|
|||
disableTracking()
|
||||
})
|
||||
|
||||
function saveView() {
|
||||
savedBounds = map.getBounds()
|
||||
}
|
||||
|
||||
function enableTracking() {
|
||||
map.locate({watch: true,
|
||||
enableHighAccuracy: true,
|
||||
|
@ -199,6 +204,7 @@ define(["map/clientlayer", "map/labelslayer",
|
|||
|
||||
map.on("locationfound", locationFound)
|
||||
map.on("locationerror", locationError)
|
||||
map.on("dragend", saveView)
|
||||
|
||||
map.addControl(locateUserButton)
|
||||
|
||||
|
@ -280,6 +286,8 @@ define(["map/clientlayer", "map/labelslayer",
|
|||
if (!nopanzoom)
|
||||
if (m)
|
||||
goto(m)
|
||||
else if (savedBounds)
|
||||
map.fitBounds(savedBounds)
|
||||
else
|
||||
resetZoom()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue