in filter fixed zoomin by default
This commit is contained in:
@@ -94,7 +94,7 @@ function is_element_unchecked(element) {
|
||||
* even if already visible in current view
|
||||
*/
|
||||
|
||||
function filter_show_only_selection(element, indexes, menu, add = false, zoom_in = false) {
|
||||
function filter_show_only_selection(element, indexes, menu, add = false, zoom_in = true) {
|
||||
|
||||
let reverse = is_element_unchecked(element);
|
||||
|
||||
@@ -102,16 +102,14 @@ function filter_show_only_selection(element, indexes, menu, add = false, zoom_in
|
||||
|
||||
let indexes_count = index_array.length;
|
||||
|
||||
// if there is no indexes,
|
||||
// if object is not empty, just render zero markers
|
||||
// if object is empty, shall all markers
|
||||
if (indexes_count !== 0) {
|
||||
// if index array, hide all other markers, and if zoomin, zoom to new markers
|
||||
g_marker_cluster.clearMarkers(true);
|
||||
|
||||
let marker = g_markers[0];
|
||||
let position = marker.getPosition();
|
||||
// let position = marker.getPosition();
|
||||
let current_bounds = g_map.getBounds();
|
||||
let bounds = new google.maps.LatLngBounds(position);
|
||||
let bounds = new google.maps.LatLngBounds();
|
||||
|
||||
let outside_bounds = false;
|
||||
for (let index of index_array) {
|
||||
@@ -133,10 +131,14 @@ function filter_show_only_selection(element, indexes, menu, add = false, zoom_in
|
||||
}
|
||||
|
||||
}
|
||||
else if ( Object.keys(g_indexes).length === 0 ) { // object is empty, there are no filters
|
||||
else if ( Object.keys(g_indexes).length === 0 ) {
|
||||
// object is empty, there are no filters
|
||||
g_map.setCenter(coordinates_default);
|
||||
g_map.setZoom(2);
|
||||
g_marker_cluster.addMarkers(g_markers, true);
|
||||
}
|
||||
else { // filters intersection lets no markers on the map
|
||||
else {
|
||||
// filters intersection lets no markers on the map
|
||||
g_marker_cluster.clearMarkers(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user