JS: google maps no-zoom param

This commit is contained in:
Tony Air 2020-02-18 03:20:18 +07:00
parent 407d12e720
commit 52daee934e

View File

@ -4,7 +4,7 @@ import $ from 'jquery';
import Events from '../../_events'; import Events from '../../_events';
import MarkerUI from './_map.google.marker'; import MarkerUI from './_map.google.marker';
const GoogleMapsDriver = (($) => { const GoogleMapsDriver = ($ => {
class GoogleMapsDriver { class GoogleMapsDriver {
getName() { getName() {
return 'GoogleMapsDriver'; return 'GoogleMapsDriver';
@ -111,8 +111,10 @@ const GoogleMapsDriver = (($) => {
if (ui.config['flyToMarker']) { if (ui.config['flyToMarker']) {
ui.map.setCenter(pos); // panTo ui.map.setCenter(pos); // panTo
if (!ui.config['noZoom']) {
ui.map.setZoom(18); ui.map.setZoom(18);
} }
}
// keep it hidden to render content // keep it hidden to render content
$popup.css({ $popup.css({
@ -122,7 +124,7 @@ const GoogleMapsDriver = (($) => {
$popup.find('.mapboxgl-popup-content .html').html(content); $popup.find('.mapboxgl-popup-content .html').html(content);
$popup.find('.mapboxgl-popup-close-button').on('click', (e) => { $popup.find('.mapboxgl-popup-close-button').on('click', e => {
e.preventDefault(); e.preventDefault();
ui.hidePopup(); ui.hidePopup();
}); });
@ -142,7 +144,7 @@ const GoogleMapsDriver = (($) => {
const $popup = $(ui.popup.getDiv()); const $popup = $(ui.popup.getDiv());
$popup.addClass('d-none'); $popup.addClass('d-none');
if (!ui.config['noRestoreBounds']) { if (!ui.config['noRestoreBounds'] || ui.config['flyToBounds']) {
ui.restoreBounds(); ui.restoreBounds();
} }
@ -207,7 +209,7 @@ const GoogleMapsDriver = (($) => {
const bounds = new google.maps.LatLngBounds(); const bounds = new google.maps.LatLngBounds();
// add markers to map // add markers to map
config['geojson'].features.forEach((marker) => { config['geojson'].features.forEach(marker => {
const id = marker.id; const id = marker.id;
const crds = marker.geometry.coordinates; const crds = marker.geometry.coordinates;
const content = marker.properties.content; const content = marker.properties.content;