Added square tool

This commit is contained in:
2019-08-30 14:40:37 -04:00
parent 37d2d33a34
commit 34e82ce85e
3 changed files with 27 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import {BehaviorSubject} from "rxjs";
import {latLngDistance} from "../utils";
import {environment} from "../../environments/environment";
import {Circle, LatLng, Marker, Measurement} from "../models/mapSymbol";
import {Circle, LatLng, Marker, Measurement, Rectangle} from "../models/mapSymbol";
declare const L;
@ -151,6 +151,14 @@ export class MapService {
return group;
}
newRectangle(r: Rectangle) {
if(!r.color) r.color = '#ff4141';
let rect = new L.Rectangle([r.latlng, r.latlng2], r).addTo(this.map);
rect.symbol = r;
rect.on('click', e => this.click.next({event: e, symbol: rect}));
return rect;
}
startDrawing() {
this.lock();
this.drawListener = e => {