Made marker tool a one click toggle

This commit is contained in:
Zakary Timson 2019-08-24 09:18:27 -04:00
parent be03d4759e
commit 7b67d24e8b

View File

@ -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);