AW-6046 Angular 17
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { Component, Input, OnDestroy, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { Layer } from 'ol/layer';
|
||||
import { View } from 'ol';
|
||||
import { OverviewMap } from 'ol/control';
|
||||
import { MapComponent } from '../map.component';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-control-overviewmap',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
})
|
||||
export class ControlOverviewMapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
@Input()
|
||||
collapsed: boolean;
|
||||
@Input()
|
||||
collapseLabel: string;
|
||||
@Input()
|
||||
collapsible: boolean;
|
||||
@Input()
|
||||
label: string;
|
||||
@Input()
|
||||
layers: Layer[];
|
||||
@Input()
|
||||
target: HTMLElement;
|
||||
@Input()
|
||||
tipLabel: string;
|
||||
@Input()
|
||||
view: View;
|
||||
|
||||
instance: OverviewMap;
|
||||
|
||||
constructor(private map: MapComponent) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.instance = new OverviewMap(this);
|
||||
this.map.instance.addControl(this.instance);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.map.instance.removeControl(this.instance);
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (this.instance != null && changes.hasOwnProperty('view')) {
|
||||
this.reloadInstance();
|
||||
}
|
||||
}
|
||||
|
||||
private reloadInstance() {
|
||||
this.map.instance.removeControl(this.instance);
|
||||
this.instance = new OverviewMap(this);
|
||||
this.map.instance.addControl(this.instance);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user