diff --git a/frappe/public/js/frappe/form/controls/geolocation.js b/frappe/public/js/frappe/form/controls/geolocation.js index 84b1989400..56a8d2a073 100644 --- a/frappe/public/js/frappe/form/controls/geolocation.js +++ b/frappe/public/js/frappe/form/controls/geolocation.js @@ -1,4 +1,4 @@ -frappe.provide("frappe.utils.utils"); +frappe.provide("frappe.utils"); frappe.ui.form.ControlGeolocation = class ControlGeolocation extends frappe.ui.form.ControlData { static horizontal = false; @@ -35,6 +35,7 @@ frappe.ui.form.ControlGeolocation = class ControlGeolocation extends frappe.ui.f } make_map(value) { + this.customize_draw_controls(); this.bind_leaflet_map(); if (this.disabled) { this.map.dragging.disable(); @@ -113,7 +114,7 @@ frappe.ui.form.ControlGeolocation = class ControlGeolocation extends frappe.ui.f */ on_each_feature(feature, layer) {} - bind_leaflet_map() { + customize_draw_controls() { const circleToGeoJSON = L.Circle.prototype.toGeoJSON; L.Circle.include({ toGeoJSON: function () { @@ -137,7 +138,10 @@ frappe.ui.form.ControlGeolocation = class ControlGeolocation extends frappe.ui.f }, }); - L.Icon.Default.imagePath = "/assets/frappe/images/leaflet/"; + L.Icon.Default.imagePath = frappe.utils.map_defaults.image_path; + } + + bind_leaflet_map() { this.map = L.map(this.map_id); this.map.setView(frappe.utils.map_defaults.center, frappe.utils.map_defaults.zoom); diff --git a/frappe/public/js/frappe/utils/utils.js b/frappe/public/js/frappe/utils/utils.js index 4a8e519978..e4cae790f2 100644 --- a/frappe/public/js/frappe/utils/utils.js +++ b/frappe/public/js/frappe/utils/utils.js @@ -1203,6 +1203,7 @@ Object.assign(frappe.utils, { attribution: '© OpenStreetMap contributors', }, + image_path: "/assets/frappe/images/leaflet/", }, icon(icon_name, size = "sm", icon_class = "", icon_style = "", svg_class = "") { diff --git a/frappe/public/js/frappe/views/map/map_view.js b/frappe/public/js/frappe/views/map/map_view.js index e9bd71e3fc..b86faf3edc 100644 --- a/frappe/public/js/frappe/views/map/map_view.js +++ b/frappe/public/js/frappe/views/map/map_view.js @@ -1,7 +1,7 @@ /** * frappe.views.MapView */ -frappe.provide("frappe.utils.utils"); +frappe.provide("frappe.utils"); frappe.provide("frappe.views"); frappe.views.MapView = class MapView extends frappe.views.ListView { @@ -32,7 +32,7 @@ frappe.views.MapView = class MapView extends frappe.views.ListView { this.$result.html(`
`); - L.Icon.Default.imagePath = "/assets/frappe/images/leaflet/"; + L.Icon.Default.imagePath = frappe.utils.map_defaults.image_path; this.map = L.map(this.map_id).setView( frappe.utils.map_defaults.center, frappe.utils.map_defaults.zoom