From eff9b213ed4a60695a78a7fa5e66d8e90f162045 Mon Sep 17 00:00:00 2001 From: ztimson Date: Sat, 31 Aug 2019 17:02:28 -0400 Subject: [PATCH] Fixed deleting problems --- src/app/models/mapSymbol.ts | 1 + src/app/views/map/map.component.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/models/mapSymbol.ts b/src/app/models/mapSymbol.ts index 299c6ae..b82e877 100644 --- a/src/app/models/mapSymbol.ts +++ b/src/app/models/mapSymbol.ts @@ -17,6 +17,7 @@ export interface MapSymbol { symbol?: any; latlng?: LatLng | LatLng[]; noDelete?: boolean; + noDeleteTool?: boolean; noSelect?: boolean; label?: string; color?: string; diff --git a/src/app/views/map/map.component.ts b/src/app/views/map/map.component.ts index 3a01991..edca401 100644 --- a/src/app/views/map/map.component.ts +++ b/src/app/views/map/map.component.ts @@ -1,6 +1,6 @@ import {Component, HostListener, isDevMode, OnDestroy, OnInit} from "@angular/core"; import {PhysicsService} from "../../services/physics.service"; -import {filter, finalize, flatMap, skip, take} from "rxjs/operators"; +import {filter, finalize, skip, take} from "rxjs/operators"; import {MatBottomSheet, MatSnackBar} from "@angular/material"; import {CalibrateComponent} from "../../components/calibrate/calibrate.component"; import {ToolbarItem} from "../../models/toolbarItem"; @@ -63,7 +63,7 @@ export class MapComponent implements OnDestroy, OnInit { startDelete = () => { this.sub = this.map.click.pipe(skip(1), filter(e => !!e.symbol)).subscribe(e => { - if (!!e.symbol && e.symbol.noDelete) return; + if (!!e.symbol && e.symbol.noDeleteTool) return; this.syncService.delete(e.symbol) }); }; @@ -244,11 +244,12 @@ export class MapComponent implements OnDestroy, OnInit { if (!this.position) this.center({lat: pos.latitude, lng: pos.longitude}); if (this.positionMarker.arrow) this.map.delete(this.positionMarker.arrow); if (this.positionMarker.circle) this.map.delete(this.positionMarker.circle); - this.syncService.addMyLocation({latlng: {lat: pos.latitude, lng: pos.longitude}, label: this.name}); + this.syncService.addMyLocation({latlng: {lat: pos.latitude, lng: pos.longitude}, label: this.name, noDeleteTool: true}); this.positionMarker.arrow = this.map.newMarker({ latlng: {lat: pos.latitude, lng: pos.longitude}, noSelect: true, noDelete: true, + noDeleteTool: true, icon: 'arrow', rotationAngle: pos.heading, rotationOrigin: 'center' @@ -258,6 +259,7 @@ export class MapComponent implements OnDestroy, OnInit { color: '#2873d8', noSelect: true, noDelete: true, + noDeleteTool: true, radius: pos.accuracy, interactive: false });