choose a safer value for max bounds
This commit is contained in:
parent
f842abd85c
commit
43adcfc665
1 changed files with 2 additions and 10 deletions
|
@ -77,7 +77,6 @@ c3nav = {
|
|||
c3nav._push_state(new_state, replace);
|
||||
|
||||
c3nav._sidebar_state_updated(new_state);
|
||||
c3nav.set_max_bounds();
|
||||
},
|
||||
update_map_state: function (replace, level, center, zoom) {
|
||||
var new_state = {
|
||||
|
@ -214,7 +213,6 @@ c3nav = {
|
|||
c3nav._locationinput_set($('#destination-input'), state.destination);
|
||||
c3nav._sidebar_state_updated(state);
|
||||
if (state.center) {
|
||||
c3nav.set_max_bounds(state.zoom);
|
||||
c3nav._levelControl.setLevel(state.level);
|
||||
var center = c3nav.map._limitCenter(L.GeoJSON.coordsToLatLng(state.center), state.zoom, c3nav.map.options.maxBounds);
|
||||
if (nofly) {
|
||||
|
@ -555,7 +553,6 @@ c3nav = {
|
|||
c3nav.update_map_state();
|
||||
},
|
||||
_map_zoomed: function () {
|
||||
c3nav.set_max_bounds();
|
||||
c3nav.update_map_state();
|
||||
},
|
||||
_add_icon: function (name) {
|
||||
|
@ -601,7 +598,6 @@ c3nav = {
|
|||
c3nav._levelControl.setLevel(level);
|
||||
if (bounds) {
|
||||
var target = c3nav.map._getBoundsCenterZoom(bounds, c3nav._add_map_padding({}));
|
||||
c3nav.set_max_bounds(target.zoom);
|
||||
var center = c3nav.map._limitCenter(target.center, target.zoom, c3nav.map.options.maxBounds);
|
||||
if (nofly) {
|
||||
c3nav.map.flyTo(center, target.zoom, { animate: false });
|
||||
|
@ -627,16 +623,12 @@ c3nav = {
|
|||
_get_padded_max_bounds: function(zoom) {
|
||||
if (zoom === undefined) zoom = c3nav.map.getZoom();
|
||||
var bounds = c3nav.bounds,
|
||||
pad = c3nav._add_map_padding({}),
|
||||
factor = Math.pow(2, zoom);
|
||||
return [
|
||||
[bounds[0][0]-(pad.paddingTopLeft.x+10)/factor, bounds[0][1]-(pad.paddingBottomRight.y+10)/factor],
|
||||
[bounds[1][0]+(pad.paddingBottomRight.x+10)/factor, bounds[1][1]+(pad.paddingTopLeft.y+10)/factor]
|
||||
[bounds[0][0]-510/factor, bounds[0][1]-30/factor],
|
||||
[bounds[1][0]+60/factor, bounds[1][1]+160/factor]
|
||||
];
|
||||
},
|
||||
set_max_bounds: function(zoom) {
|
||||
c3nav.map.setMaxBounds(L.GeoJSON.coordsToLatLngs(c3nav._get_padded_max_bounds(zoom)));
|
||||
},
|
||||
_add_location_to_map: function(location, icon) {
|
||||
// add a location to the map as a marker
|
||||
if (location.locations) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue