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.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:globaleditmodetoggled', (e) => this.ignoreUpdateBounds = e.enabled);
|
||||||
this.map.on('pm:globaldragmodetoggled', (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);
|
this.map.on('pm:globalremovalmodetoggled', (e) => this.ignoreUpdateBounds = e.enabled);
|
||||||
@ -754,9 +755,6 @@ export default abstract class LeafletMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateBoundsInternal() {
|
private updateBoundsInternal() {
|
||||||
if (this.ignoreUpdateBounds) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const bounds = new L.LatLngBounds(null, null);
|
const bounds = new L.LatLngBounds(null, null);
|
||||||
if (this.drawRoutes) {
|
if (this.drawRoutes) {
|
||||||
this.polylines.forEach((polyline) => {
|
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)
|
if (bounds.isValid() && (!this.bounds || !this.bounds.isValid() || !this.bounds.equals(bounds)
|
||||||
&& this.options.fitMapBounds ? !mapBounds.contains(bounds) : false)) {
|
&& this.options.fitMapBounds ? !mapBounds.contains(bounds) : false)) {
|
||||||
this.bounds = bounds;
|
this.bounds = bounds;
|
||||||
this.fitBounds(bounds);
|
if (!this.ignoreUpdateBounds) {
|
||||||
|
this.fitBounds(bounds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,6 +70,9 @@ export class Polygon {
|
|||||||
// Change position (call in drag drop mode)
|
// Change position (call in drag drop mode)
|
||||||
this.leafletPoly.on('pm:dragstart', () => this.editing = true);
|
this.leafletPoly.on('pm:dragstart', () => this.editing = true);
|
||||||
this.leafletPoly.on('pm:dragend', () => this.editing = false);
|
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)
|
// Change size/point (call in edit mode)
|
||||||
this.leafletPoly.on('pm:markerdragstart', () => this.editing = true);
|
this.leafletPoly.on('pm:markerdragstart', () => this.editing = true);
|
||||||
this.leafletPoly.on('pm:markerdragend', () => this.editing = false);
|
this.leafletPoly.on('pm:markerdragend', () => this.editing = false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user