Made marker tool a one click toggle
This commit is contained in:
parent
be03d4759e
commit
7b67d24e8b
@ -25,7 +25,7 @@ export class MapComponent implements OnInit {
|
|||||||
showPalette = false;
|
showPalette = false;
|
||||||
|
|
||||||
menu: ToolbarItem[] = [
|
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: 'Draw', icon: 'create', toggle: true, onEnabled: () => this.startDrawing(), onDisabled: () => this.endDrawing()},
|
||||||
{name: 'Measure', icon: 'straighten', toggle: true, click: () => this.measure()},
|
{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},
|
{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() {
|
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.menu[0].enabled = false;
|
||||||
this.markers.push(latlng);
|
this.markers.push(latlng);
|
||||||
this.map.newMarker(latlng);
|
this.map.newMarker(latlng);
|
||||||
|
Loading…
Reference in New Issue
Block a user