File

libs/map/src/lib/control/locate/locate.component.ts

Extends

MapControlComponent

Metadata

selector n52-locate-control
styleUrls ./locate.component.scss
templateUrl ./locate.component.html

Index

Properties
Methods
Inputs

Constructor

constructor(locateService: LocateService, mapCache: MapCache)
Parameters :
Name Type Optional
locateService LocateService No
mapCache MapCache No

Inputs

mapId
Type : string
mapId
Type : string
Inherited from MapControlComponent

Connect map id.

Methods

Public locateUser
locateUser()
Returns : void

Properties

Public isToggled
Default value : false
import { Component, Input } from '@angular/core';

import { MapControlComponent } from '../map-control-component';
import { LocateService } from './locate.service';
import { MapCache } from '../../base/map-cache.service';

@Component({
    selector: 'n52-locate-control',
    templateUrl: './locate.component.html',
    styleUrls: ['./locate.component.scss']
})
export class LocateControlComponent extends MapControlComponent {

    @Input()
    public mapId: string;

    public isToggled = false;

    constructor(
        protected locateService: LocateService,
        protected mapCache: MapCache
    ) {
        super(mapCache);
    }

    public locateUser() {
        this.isToggled = !this.isToggled;
        if (this.isToggled) {
            this.locateService.startLocate(this.mapId);
        } else {
            this.locateService.stopLocate(this.mapId);
        }
    }
}
<div class="btn-group-vertical btn-group-sm map-control">
  <button type="button" class="btn btn-sm" (click)="locateUser()" [ngClass]="isToggled ? 'btn-primary': 'btn-light'">
    locate
  </button>
</div>

./locate.component.scss

:host {
    i {
        width: 11px;
    }
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""