Don't change map view when toggling markers.
This commit is contained in:
parent
38588ae27d
commit
c0da94a4a9
@ -10,9 +10,6 @@ class window.OwnMap
|
|||||||
@markermgr.setFilter [selected_tid]
|
@markermgr.setFilter [selected_tid]
|
||||||
|
|
||||||
@map_drawn = false
|
@map_drawn = false
|
||||||
@default_zoom = 15
|
|
||||||
@default_centre = [0, 0]
|
|
||||||
|
|
||||||
@live_view = false
|
@live_view = false
|
||||||
@live_view_timer = false
|
@live_view_timer = false
|
||||||
|
|
||||||
@ -189,7 +186,7 @@ class window.OwnMap
|
|||||||
if @drawMap()
|
if @drawMap()
|
||||||
$('#mapid').css 'filter', 'blur(0px)'
|
$('#mapid').css 'filter', 'blur(0px)'
|
||||||
|
|
||||||
drawMap: ->
|
drawMap: (rezoom = true) ->
|
||||||
console.log 'OwnMap::drawMap()'
|
console.log 'OwnMap::drawMap()'
|
||||||
if @map_drawn
|
if @map_drawn
|
||||||
@markermgr.removeMarkersFrom @mymap
|
@markermgr.removeMarkersFrom @mymap
|
||||||
@ -199,18 +196,10 @@ class window.OwnMap
|
|||||||
@markermgr.addMarkersTo @mymap
|
@markermgr.addMarkersTo @mymap
|
||||||
@markermgr.addLinesTo @mymap
|
@markermgr.addLinesTo @mymap
|
||||||
|
|
||||||
# save default zoom scale
|
if rezoom
|
||||||
@setDefaultZoom()
|
@resetZoom()
|
||||||
# auto zoom scale based on all markers location
|
|
||||||
@mymap.fitBounds @markermgr.getMarkerBounds()
|
|
||||||
@map_drawn = true
|
|
||||||
|
|
||||||
setDefaultZoom: ->
|
@map_drawn = true
|
||||||
console.log 'OwnMap::setDefaultZoom()'
|
|
||||||
setTimeout =>
|
|
||||||
@default_zoom = @mymap.getZoom()
|
|
||||||
@default_centre = @mymap.getCenter()
|
|
||||||
, 2000
|
|
||||||
|
|
||||||
setMarkerFilter: (tid) ->
|
setMarkerFilter: (tid) ->
|
||||||
console.log 'OwnMap::setMarkerFilter(%o)', tid
|
console.log 'OwnMap::setMarkerFilter(%o)', tid
|
||||||
@ -225,17 +214,18 @@ class window.OwnMap
|
|||||||
console.log 'OwnMap::showMarkers()'
|
console.log 'OwnMap::showMarkers()'
|
||||||
@markermgr.startstop_only = false
|
@markermgr.startstop_only = false
|
||||||
Cookies.set 'show_markers', 1, { expires: 365 }
|
Cookies.set 'show_markers', 1, { expires: 365 }
|
||||||
@drawMap()
|
@drawMap false
|
||||||
|
|
||||||
hideMarkers: ->
|
hideMarkers: ->
|
||||||
console.log 'OwnMap::hideMarkers()'
|
console.log 'OwnMap::hideMarkers()'
|
||||||
@markermgr.startstop_only = true
|
@markermgr.startstop_only = true
|
||||||
Cookies.set 'show_markers', 0, { expires: 365 }
|
Cookies.set 'show_markers', 0, { expires: 365 }
|
||||||
@drawMap()
|
@drawMap false
|
||||||
|
|
||||||
resetZoom: ->
|
resetZoom: ->
|
||||||
console.log 'OwnMap::resetZoom()'
|
console.log 'OwnMap::resetZoom()'
|
||||||
@mymap.setView @default_centre, @default_zoom
|
# auto zoom scale based on all markers location
|
||||||
|
@mymap.fitBounds @markermgr.getMarkerBounds()
|
||||||
|
|
||||||
exportGpx: ->
|
exportGpx: ->
|
||||||
console.log 'OwnMap::exportGpx()'
|
console.log 'OwnMap::exportGpx()'
|
||||||
|
Reference in New Issue
Block a user