Explorar el Código

Merge pull request #16513 from alyf-de/default-map-view

fix: stabilize leaflet map
version-14
mergify[bot] hace 3 años
committed by GitHub
padre
commit
81ece0197e
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 4AEE18F83AFDEB23
Se han modificado 1 ficheros con 5 adiciones y 6 borrados
  1. +5
    -6
      frappe/public/js/frappe/form/controls/geolocation.js

+ 5
- 6
frappe/public/js/frappe/form/controls/geolocation.js Ver fichero

@@ -58,7 +58,7 @@ frappe.ui.form.ControlGeolocation = class ControlGeolocation extends frappe.ui.f
}));
this.add_non_group_layers(data_layers, this.editableLayers);
try {
this.map.flyToBounds(this.editableLayers.getBounds(), {
this.map.fitBounds(this.editableLayers.getBounds(), {
padding: [50,50]
});
}
@@ -66,10 +66,10 @@ frappe.ui.form.ControlGeolocation = class ControlGeolocation extends frappe.ui.f
// suppress error if layer has a point.
}
this.editableLayers.addTo(this.map);
this.map._onResize();
} else if ((value===undefined) || (value == JSON.stringify(new L.FeatureGroup().toGeoJSON()))) {
this.locate_control.start();
} else {
this.map.setView(frappe.utils.map_defaults.center, frappe.utils.map_defaults.zoom);
}
this.map.invalidateSize();
}

bind_leaflet_map() {
@@ -97,8 +97,7 @@ frappe.ui.form.ControlGeolocation = class ControlGeolocation extends frappe.ui.f
});

L.Icon.Default.imagePath = '/assets/frappe/images/leaflet/';
this.map = L.map(this.map_id).setView(frappe.utils.map_defaults.center,
frappe.utils.map_defaults.zoom);
this.map = L.map(this.map_id);

L.tileLayer(frappe.utils.map_defaults.tiles,
frappe.utils.map_defaults.options).addTo(this.map);


Cargando…
Cancelar
Guardar