Fix zoom to all areas when WKT is empty.
This commit is contained in:
parent
6d8d070198
commit
dd717a1f5c
|
@ -70,8 +70,9 @@ function farm_area_farm_map_view($name, $element) {
|
|||
farm_map_add_behavior('areas', array('zoom' => TRUE));
|
||||
}
|
||||
|
||||
// Show "all areas" layer in geofield maps.
|
||||
// Show "all areas" layer in geofield maps, and zoom to them if no WKT is set.
|
||||
if (in_array($name, array('farm_map_geofield', 'farm_map_geofield_widget'))) {
|
||||
farm_map_add_behavior('areas_combined', array('zoom' => FALSE));
|
||||
$zoom = empty($element['#wkt']) || $element['#wkt'] == 'GEOMETRYCOLLECTION EMPTY';
|
||||
farm_map_add_behavior('areas_combined', array('zoom' => $zoom));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,13 +32,8 @@
|
|||
|
||||
// If zoom is true and the layer has features, zoom to them.
|
||||
// Otherwise, zoom to all vectors.
|
||||
if (Drupal.settings.farm_map.behaviors.wkt.zoom) {
|
||||
if (layer !== undefined) {
|
||||
instance.zoomToLayer(layer);
|
||||
}
|
||||
else {
|
||||
instance.zoomToVectors();
|
||||
}
|
||||
if (Drupal.settings.farm_map.behaviors.wkt.zoom && layer !== undefined) {
|
||||
instance.zoomToLayer(layer);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue