Improve behaviour of browse pages when no bounding box is available

This commit is contained in:
Tom Hughes 2013-10-01 22:46:16 +01:00
parent 2d0dcbd9d0
commit e19e996f1f
2 changed files with 7 additions and 6 deletions

View file

@ -61,9 +61,10 @@ $(document).ready(function () {
zoom: true, zoom: true,
callback: function(extent) { callback: function(extent) {
$("#loading").hide(); $("#loading").hide();
$("#browse_map .secondary-actions").show();
if (extent) { if (extent && extent.isValid()) {
$("#browse_map .secondary-actions").show();
$("a.bbox[data-editor=remote]").click(function () { $("a.bbox[data-editor=remote]").click(function () {
return remoteEditHandler(extent); return remoteEditHandler(extent);
}); });
@ -76,8 +77,6 @@ $(document).ready(function () {
$("#object_edit").show(); $("#object_edit").show();
updatelinks(map.getCenter(), 16, null, extent, object); updatelinks(map.getCenter(), 16, null, extent, object);
} else {
$("#small_map").hide();
} }
} }
}); });

View file

@ -140,8 +140,10 @@ L.extend(L.Map.prototype, {
map._objectLayer.addData(xml); map._objectLayer.addData(xml);
if (options.zoom) map.fitBounds(map._objectLayer.getBounds()); var bounds = map._objectLayer.getBounds();
if (options.callback) options.callback(map._objectLayer.getBounds());
if (options.zoom && bounds.isValid()) map.fitBounds(bounds);
if (options.callback) options.callback(bounds);
map._objectLayer.addTo(map); map._objectLayer.addTo(map);
} }