From 9c67e5379fc49a60e68b2181e32dd06e2012254e Mon Sep 17 00:00:00 2001 From: ztimson Date: Sun, 8 Sep 2019 20:29:52 -0400 Subject: [PATCH] Update the right symbol type --- .../components/editSymbol/editSymbol.component.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/components/editSymbol/editSymbol.component.ts b/src/app/components/editSymbol/editSymbol.component.ts index f877d14..b7879ee 100644 --- a/src/app/components/editSymbol/editSymbol.component.ts +++ b/src/app/components/editSymbol/editSymbol.component.ts @@ -2,6 +2,8 @@ import {Component, Inject} from "@angular/core"; import {MapSymbol} from "../../models/mapSymbol"; import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef} from "@angular/material/bottom-sheet"; +declare const L; + @Component({ selector: 'edit-symbol', templateUrl: 'editSymbol.component.html' @@ -19,20 +21,20 @@ export class EditSymbolComponent { } close() { - if(this.mapItem.getRadius) { + if(this.mapItem instanceof L.Circle) { let latlng = this.mapItem.getLatLng(); this.symbol.latlng = {lat: latlng.lat, lng: latlng.lng}; this.symbol['radius'] = this.mapItem.getRadius(); - } else if(this.mapItem.getLatLngs) { + } else if(this.mapItem instanceof L.Marker) { + let latlng = this.mapItem.getLatLng(); + this.symbol.latlng = {lat: latlng.lat, lng: latlng.lng}; + } else if(this.mapItem instanceof L.Polygon) { let path = this.mapItem.getLatLngs(); this.symbol.latlng = path[0].map(latlng => ({lat: latlng.lat, lng: latlng.lng})); - } else if(this.mapItem.getBounds) { + } else if(this.mapItem instanceof L.Rectangle) { let bounds = this.mapItem.getBounds(); this.symbol.latlng = {lat: bounds['_northEast'].lat, lng: bounds['_northEast'].lng}; this.symbol['latlng2'] = {lat: bounds['_southWest'].lat, lng: bounds['_southWest'].lng}; - } else if(this.mapItem.getLatLng) { - let latlng = this.mapItem.getLatLng(); - this.symbol.latlng = {lat: latlng.lat, lng: latlng.lng}; } this.ref.dismiss(this.symbol);