added global max zoom
- better map center - default filter same bounds as init map
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
// bounds : https://stackoverflow.com/questions/19304574/center-set-zoom-of-map-to-cover-all-visible-markers/19304625#19304625
|
||||
|
||||
/**
|
||||
* if show_only is true:
|
||||
* erase all other markers from the map,
|
||||
* else, they stay visible
|
||||
* if zoom_in is true:
|
||||
* zoom to new selection,
|
||||
* even if already visible in current view
|
||||
*/
|
||||
function filter_show_only_selection(indexes, show_only = true) {
|
||||
function filter_show_only_selection(indexes, zoom_in = false) {
|
||||
|
||||
console.log("indexes:");
|
||||
console.log(indexes);
|
||||
@@ -17,8 +17,7 @@ function filter_show_only_selection(indexes, show_only = true) {
|
||||
if (indexes_count === 0)
|
||||
return;
|
||||
|
||||
if (show_only)
|
||||
g_marker_cluster.clearMarkers(true);
|
||||
g_marker_cluster.clearMarkers(true);
|
||||
|
||||
let marker = g_markers[0];
|
||||
let position = marker.getPosition();
|
||||
@@ -37,23 +36,23 @@ function filter_show_only_selection(indexes, show_only = true) {
|
||||
outside_bounds = true;
|
||||
bounds.extend(position);
|
||||
|
||||
if (show_only)
|
||||
g_marker_cluster.addMarker(marker, true);
|
||||
g_marker_cluster.addMarker(marker, true);
|
||||
}
|
||||
if ( show_only == false || (show_only && outside_bounds) ) {
|
||||
if (zoom_in || outside_bounds) {
|
||||
if (indexes_count === 1) {
|
||||
g_map.setCenter(position);
|
||||
g_map.setZoom(5);
|
||||
g_map.setZoom(max_zoom);
|
||||
}
|
||||
else if (indexes_count > 1)
|
||||
g_map.fitBounds(bounds);
|
||||
}
|
||||
if (show_only)
|
||||
g_marker_cluster.render();
|
||||
g_marker_cluster.render();
|
||||
|
||||
}
|
||||
|
||||
function filter_show_all() {
|
||||
g_marker_cluster.addMarkers(g_markers);
|
||||
g_map.fitBounds(g_init_bounds);
|
||||
//g_map.fitBounds(g_init_bounds);
|
||||
g_map.setCenter(coordinates_default);
|
||||
g_map.setZoom(2);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ function mp_init_map() {
|
||||
* - let icon_color_back = ""
|
||||
* - let icon_size = [x, y]
|
||||
* - let cluster_size_factor = Number
|
||||
* - let max_zoom = x
|
||||
*/
|
||||
|
||||
console.log("locations:");
|
||||
|
||||
Reference in New Issue
Block a user