UI: Map widgets - Fixed autozoom in edit mode.
This commit is contained in:
parent
8bca3b4fce
commit
9cf12cbdfb
@ -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,9 +783,11 @@ 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;
|
||||
if (!this.ignoreUpdateBounds) {
|
||||
this.fitBounds(bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Markers
|
||||
updateMarkers(markersData: FormattedData[], updateBounds = true, callback?) {
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user