diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts index f0bcdae1b6..db3bb6eab7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts @@ -355,6 +355,7 @@ export default abstract class LeafletMap { this.ignoreUpdateBounds = true; } + this.map.on('pm:globaldrawmodetoggled', (e) => this.ignoreUpdateBounds = e.enabled); this.map.on('pm:globaleditmodetoggled', (e) => this.ignoreUpdateBounds = e.enabled); this.map.on('pm:globaldragmodetoggled', (e) => this.ignoreUpdateBounds = e.enabled); this.map.on('pm:globalremovalmodetoggled', (e) => this.ignoreUpdateBounds = e.enabled); @@ -754,9 +755,6 @@ export default abstract class LeafletMap { } private updateBoundsInternal() { - if (this.ignoreUpdateBounds) { - return; - } const bounds = new L.LatLngBounds(null, null); if (this.drawRoutes) { this.polylines.forEach((polyline) => { @@ -785,7 +783,9 @@ export default abstract class LeafletMap { if (bounds.isValid() && (!this.bounds || !this.bounds.isValid() || !this.bounds.equals(bounds) && this.options.fitMapBounds ? !mapBounds.contains(bounds) : false)) { this.bounds = bounds; - this.fitBounds(bounds); + if (!this.ignoreUpdateBounds) { + this.fitBounds(bounds); + } } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts index 1dd0b63d65..527ef1056f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts @@ -70,6 +70,9 @@ export class Polygon { // Change position (call in drag drop mode) this.leafletPoly.on('pm:dragstart', () => this.editing = true); this.leafletPoly.on('pm:dragend', () => this.editing = false); + // Rotate (call in rotate mode) + this.leafletPoly.on('pm:rotatestart', () => this.editing = true); + this.leafletPoly.on('pm:rotateend', () => this.editing = false); // Change size/point (call in edit mode) this.leafletPoly.on('pm:markerdragstart', () => this.editing = true); this.leafletPoly.on('pm:markerdragend', () => this.editing = false);