From 7b67d24e8bd75032044118a9ffc601043c77ca6a Mon Sep 17 00:00:00 2001 From: ztimson Date: Sat, 24 Aug 2019 09:18:27 -0400 Subject: [PATCH] Made marker tool a one click toggle --- src/app/views/map/map.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/views/map/map.component.ts b/src/app/views/map/map.component.ts index 8211bfb..55b07b8 100644 --- a/src/app/views/map/map.component.ts +++ b/src/app/views/map/map.component.ts @@ -25,7 +25,7 @@ export class MapComponent implements OnInit { showPalette = false; menu: ToolbarItem[] = [ - {name: 'Marker', icon: 'room', click: () => this.addMarker()}, + {name: 'Marker', icon: 'room', toggle: true, click: () => { this.addMarker(); }}, {name: 'Draw', icon: 'create', toggle: true, onEnabled: () => this.startDrawing(), onDisabled: () => this.endDrawing()}, {name: 'Measure', icon: 'straighten', toggle: true, click: () => this.measure()}, {name: 'Delete', icon: 'delete', toggle: true, onEnabled: () => this.map.deleteMode = true, onDisabled: () => this.map.deleteMode = false}, @@ -74,7 +74,7 @@ export class MapComponent implements OnInit { } addMarker() { - this.map.click.pipe(skip(1), take(1)).subscribe(latlng => { + this.map.click.pipe(skip(1), take(1), filter(() => this.menu[0].enabled)).subscribe(latlng => { this.menu[0].enabled = false; this.markers.push(latlng); this.map.newMarker(latlng);