hopefully fix the level undefined bug
This commit is contained in:
parent
ccf676e5c7
commit
a4f363a9f2
1 changed files with 7 additions and 4 deletions
|
@ -305,9 +305,12 @@ c3nav = {
|
||||||
|
|
||||||
c3nav._sidebar_state_updated(new_state);
|
c3nav._sidebar_state_updated(new_state);
|
||||||
},
|
},
|
||||||
|
current_level: function() {
|
||||||
|
return c3nav._levelControl.currentLevel || c3nav.resume_level;
|
||||||
|
},
|
||||||
update_map_state: function (replace, level, center, zoom) {
|
update_map_state: function (replace, level, center, zoom) {
|
||||||
var new_state = {
|
var new_state = {
|
||||||
level: center ? level : c3nav._levelControl.currentLevel,
|
level: center ? level : c3nav.current_level(),
|
||||||
center: L.GeoJSON.latLngToCoords(center ? center : c3nav.map.getCenter(), 2),
|
center: L.GeoJSON.latLngToCoords(center ? center : c3nav.map.getCenter(), 2),
|
||||||
zoom: Math.round((center ? zoom : c3nav.map.getZoom()) * 100) / 100
|
zoom: Math.round((center ? zoom : c3nav.map.getZoom()) * 100) / 100
|
||||||
};
|
};
|
||||||
|
@ -388,7 +391,7 @@ c3nav = {
|
||||||
update_location_labels: function() {
|
update_location_labels: function() {
|
||||||
if (!c3nav._labelControl.labelsActive) return;
|
if (!c3nav._labelControl.labelsActive) return;
|
||||||
c3nav._labelLayer.clearLayers();
|
c3nav._labelLayer.clearLayers();
|
||||||
var labels = c3nav.labels[c3nav._levelControl.currentLevel],
|
var labels = c3nav.labels[c3nav.current_level()],
|
||||||
bounds = c3nav.map.getBounds().pad(0.15),
|
bounds = c3nav.map.getBounds().pad(0.15),
|
||||||
zoom = c3nav.map.getZoom();
|
zoom = c3nav.map.getZoom();
|
||||||
if (!labels) return;
|
if (!labels) return;
|
||||||
|
@ -1462,7 +1465,7 @@ c3nav = {
|
||||||
popup.on('remove', function() { c3nav._click_anywhere_popup = null }).openOn(c3nav.map);
|
popup.on('remove', function() { c3nav._click_anywhere_popup = null }).openOn(c3nav.map);
|
||||||
},
|
},
|
||||||
_latlng_to_name: function(latlng) {
|
_latlng_to_name: function(latlng) {
|
||||||
var level = c3nav._levelControl.currentLevel;
|
var level = c3nav.current_level();
|
||||||
return 'c:'+String(c3nav.level_labels_by_id[level])+':'+Math.round(latlng.lng*100)/100+':'+Math.round(latlng.lat*100)/100;
|
return 'c:'+String(c3nav.level_labels_by_id[level])+':'+Math.round(latlng.lng*100)/100+':'+Math.round(latlng.lat*100)/100;
|
||||||
},
|
},
|
||||||
_click_anywhere_load: function(nearby) {
|
_click_anywhere_load: function(nearby) {
|
||||||
|
@ -1555,7 +1558,7 @@ c3nav = {
|
||||||
},
|
},
|
||||||
fly_to_bounds: function(replace_state, nofly) {
|
fly_to_bounds: function(replace_state, nofly) {
|
||||||
// fly to the bounds of the current overlays
|
// fly to the bounds of the current overlays
|
||||||
var level = c3nav._levelControl.currentLevel,
|
var level = c3nav.current_level(),
|
||||||
bounds = null;
|
bounds = null;
|
||||||
|
|
||||||
if (c3nav._firstRouteLevel) {
|
if (c3nav._firstRouteLevel) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue