Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
31 lines
849 B
TypeScript
31 lines
849 B
TypeScript
import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
|
|
import { Attribution } from 'ol/control';
|
|
import { MapComponent } from '../map.component';
|
|
|
|
@Component({
|
|
selector: 'aol-control-attribution',
|
|
template: ``,
|
|
})
|
|
export class ControlAttributionComponent implements OnInit, OnDestroy {
|
|
@Input()
|
|
collapsible: boolean;
|
|
|
|
componentType = 'control';
|
|
instance: Attribution;
|
|
target: Element;
|
|
|
|
constructor(private map: MapComponent, private element: ElementRef) {}
|
|
|
|
ngOnInit() {
|
|
this.target = this.element.nativeElement;
|
|
// console.log('ol.control.Attribution init: ', this);
|
|
this.instance = new Attribution(this);
|
|
this.map.instance.addControl(this.instance);
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
// console.log('removing aol-control-attribution');
|
|
this.map.instance.removeControl(this.instance);
|
|
}
|
|
}
|