FarmMapsLib/projects/ng-openlayers/src/lib/interactions/pinchzoom.component.ts

28 lines
648 B
TypeScript

import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { PinchZoom } from 'ol/interaction';
import { MapComponent } from '../map.component';
@Component({
selector: 'aol-interaction-pinchzoom',
template: '',
})
export class PinchZoomInteractionComponent implements OnInit, OnDestroy {
@Input()
duration: number;
@Input()
constrainResolution: boolean;
instance: PinchZoom;
constructor(private map: MapComponent) {}
ngOnInit() {
this.instance = new PinchZoom(this);
this.map.instance.addInteraction(this.instance);
}
ngOnDestroy() {
this.map.instance.removeInteraction(this.instance);
}
}