fixed measure tool
This commit is contained in:
parent
01c9a9041e
commit
72d5567c4e
@ -214,12 +214,12 @@ export class MapComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
startMeasuring = menuItem => {
|
startMeasuring = menuItem => {
|
||||||
let lastPoint;
|
let lastPoint;
|
||||||
this.sub = this.map.click.pipe(skip(1), take(2), finalize(() => this.map.delete(lastPoint))).subscribe(e => {
|
this.sub = this.map.click.pipe(skip(1), finalize(() => this.map.delete(lastPoint))).subscribe(e => {
|
||||||
if (lastPoint) {
|
if (lastPoint) {
|
||||||
menuItem.enabled = false;
|
menuItem.enabled = false;
|
||||||
let measurement = {latlng: {lat: lastPoint.getLatLng().lat, lng: lastPoint.getLatLng().lng}, latlng2: e.latlng};
|
let measurement = {latlng: {lat: lastPoint.getLatLng().lat, lng: lastPoint.getLatLng().lng}, latlng2: e.latlng};
|
||||||
this.syncService.addMeasurement(measurement);
|
this.syncService.addMeasurement(measurement);
|
||||||
return this.map.delete(lastPoint);
|
this.map.delete(lastPoint);
|
||||||
}
|
}
|
||||||
lastPoint = this.map.newMarker({latlng: e.latlng, color: '#ff4141'});
|
lastPoint = this.map.newMarker({latlng: e.latlng, color: '#ff4141'});
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user