From ac8466d3d8b217a30b79bbb6eda2c99be2a5e834 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:27:41 +0200 Subject: [PATCH] refactor(Geolocation): customize_draw_controls Extract method `customize_draw_controls` from `bind_leaflet_map` --- frappe/public/js/frappe/form/controls/geolocation.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/geolocation.js b/frappe/public/js/frappe/form/controls/geolocation.js index 84b1989400..acff3d6ce8 100644 --- a/frappe/public/js/frappe/form/controls/geolocation.js +++ b/frappe/public/js/frappe/form/controls/geolocation.js @@ -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 () { @@ -138,6 +139,9 @@ frappe.ui.form.ControlGeolocation = class ControlGeolocation extends frappe.ui.f }); L.Icon.Default.imagePath = "/assets/frappe/images/leaflet/"; + } + + bind_leaflet_map() { this.map = L.map(this.map_id); this.map.setView(frappe.utils.map_defaults.center, frappe.utils.map_defaults.zoom);