Fixed deleting problems
This commit is contained in:
parent
20ae1708a9
commit
eff9b213ed
@ -17,6 +17,7 @@ export interface MapSymbol {
|
|||||||
symbol?: any;
|
symbol?: any;
|
||||||
latlng?: LatLng | LatLng[];
|
latlng?: LatLng | LatLng[];
|
||||||
noDelete?: boolean;
|
noDelete?: boolean;
|
||||||
|
noDeleteTool?: boolean;
|
||||||
noSelect?: boolean;
|
noSelect?: boolean;
|
||||||
label?: string;
|
label?: string;
|
||||||
color?: string;
|
color?: string;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Component, HostListener, isDevMode, OnDestroy, OnInit} from "@angular/core";
|
import {Component, HostListener, isDevMode, OnDestroy, OnInit} from "@angular/core";
|
||||||
import {PhysicsService} from "../../services/physics.service";
|
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 {MatBottomSheet, MatSnackBar} from "@angular/material";
|
||||||
import {CalibrateComponent} from "../../components/calibrate/calibrate.component";
|
import {CalibrateComponent} from "../../components/calibrate/calibrate.component";
|
||||||
import {ToolbarItem} from "../../models/toolbarItem";
|
import {ToolbarItem} from "../../models/toolbarItem";
|
||||||
@ -63,7 +63,7 @@ export class MapComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
startDelete = () => {
|
startDelete = () => {
|
||||||
this.sub = this.map.click.pipe(skip(1), filter(e => !!e.symbol)).subscribe(e => {
|
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)
|
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.position) this.center({lat: pos.latitude, lng: pos.longitude});
|
||||||
if (this.positionMarker.arrow) this.map.delete(this.positionMarker.arrow);
|
if (this.positionMarker.arrow) this.map.delete(this.positionMarker.arrow);
|
||||||
if (this.positionMarker.circle) this.map.delete(this.positionMarker.circle);
|
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({
|
this.positionMarker.arrow = this.map.newMarker({
|
||||||
latlng: {lat: pos.latitude, lng: pos.longitude},
|
latlng: {lat: pos.latitude, lng: pos.longitude},
|
||||||
noSelect: true,
|
noSelect: true,
|
||||||
noDelete: true,
|
noDelete: true,
|
||||||
|
noDeleteTool: true,
|
||||||
icon: 'arrow',
|
icon: 'arrow',
|
||||||
rotationAngle: pos.heading,
|
rotationAngle: pos.heading,
|
||||||
rotationOrigin: 'center'
|
rotationOrigin: 'center'
|
||||||
@ -258,6 +259,7 @@ export class MapComponent implements OnDestroy, OnInit {
|
|||||||
color: '#2873d8',
|
color: '#2873d8',
|
||||||
noSelect: true,
|
noSelect: true,
|
||||||
noDelete: true,
|
noDelete: true,
|
||||||
|
noDeleteTool: true,
|
||||||
radius: pos.accuracy,
|
radius: pos.accuracy,
|
||||||
interactive: false
|
interactive: false
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user