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 self = this
|
||||||
var barycenter
|
var barycenter
|
||||||
var groupOnline, groupOffline, groupNew, groupLost, groupLines
|
var groupOnline, groupOffline, groupNew, groupLost, groupLines
|
||||||
|
var savedBounds
|
||||||
|
|
||||||
var map, userLocation
|
var map, userLocation
|
||||||
var layerControl
|
var layerControl
|
||||||
|
@ -134,6 +135,10 @@ define(["map/clientlayer", "map/labelslayer",
|
||||||
disableTracking()
|
disableTracking()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function saveView() {
|
||||||
|
savedBounds = map.getBounds()
|
||||||
|
}
|
||||||
|
|
||||||
function enableTracking() {
|
function enableTracking() {
|
||||||
map.locate({watch: true,
|
map.locate({watch: true,
|
||||||
enableHighAccuracy: true,
|
enableHighAccuracy: true,
|
||||||
|
@ -199,6 +204,7 @@ define(["map/clientlayer", "map/labelslayer",
|
||||||
|
|
||||||
map.on("locationfound", locationFound)
|
map.on("locationfound", locationFound)
|
||||||
map.on("locationerror", locationError)
|
map.on("locationerror", locationError)
|
||||||
|
map.on("dragend", saveView)
|
||||||
|
|
||||||
map.addControl(locateUserButton)
|
map.addControl(locateUserButton)
|
||||||
|
|
||||||
|
@ -280,6 +286,8 @@ define(["map/clientlayer", "map/labelslayer",
|
||||||
if (!nopanzoom)
|
if (!nopanzoom)
|
||||||
if (m)
|
if (m)
|
||||||
goto(m)
|
goto(m)
|
||||||
|
else if (savedBounds)
|
||||||
|
map.fitBounds(savedBounds)
|
||||||
else
|
else
|
||||||
resetZoom()
|
resetZoom()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue