From 2f1d18c0d9d42f3e7dae38bd91e9f6b94535915f Mon Sep 17 00:00:00 2001 From: "R. Lemos" Date: Thu, 3 Sep 2020 12:19:12 -0300 Subject: [PATCH] add support to `onFocusOnly` option for interactions --- .../src/lib/interactions/default.component.ts | 6 ++++-- .../src/lib/interactions/dragpan.component.ts | 2 ++ .../src/lib/interactions/mousewheelzoom.component.ts | 2 ++ projects/ngx-openlayers/src/lib/map.component.ts | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/projects/ngx-openlayers/src/lib/interactions/default.component.ts b/projects/ngx-openlayers/src/lib/interactions/default.component.ts index e0a44e2e..76aaee54 100644 --- a/projects/ngx-openlayers/src/lib/interactions/default.component.ts +++ b/projects/ngx-openlayers/src/lib/interactions/default.component.ts @@ -1,4 +1,4 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { defaults, Interaction } from 'ol/interaction'; import { Collection } from 'ol'; import { MapComponent } from '../map.component'; @@ -9,11 +9,13 @@ import { MapComponent } from '../map.component'; }) export class DefaultInteractionComponent implements OnInit, OnDestroy { instance: Collection; + @Input() + public onFocusOnly: boolean; constructor(private map: MapComponent) {} ngOnInit() { - this.instance = defaults(); + this.instance = defaults(this); this.instance.forEach((i) => this.map.instance.addInteraction(i)); } diff --git a/projects/ngx-openlayers/src/lib/interactions/dragpan.component.ts b/projects/ngx-openlayers/src/lib/interactions/dragpan.component.ts index 3f281f87..160dac64 100644 --- a/projects/ngx-openlayers/src/lib/interactions/dragpan.component.ts +++ b/projects/ngx-openlayers/src/lib/interactions/dragpan.component.ts @@ -15,6 +15,8 @@ export class DragPanInteractionComponent implements OnInit, OnDestroy { condition: Condition; @Input() kinetic: Kinetic; + @Input() + onFocusOnly: boolean; constructor(private map: MapComponent) {} diff --git a/projects/ngx-openlayers/src/lib/interactions/mousewheelzoom.component.ts b/projects/ngx-openlayers/src/lib/interactions/mousewheelzoom.component.ts index c64deacd..17aadc51 100644 --- a/projects/ngx-openlayers/src/lib/interactions/mousewheelzoom.component.ts +++ b/projects/ngx-openlayers/src/lib/interactions/mousewheelzoom.component.ts @@ -14,6 +14,8 @@ export class MouseWheelZoomInteractionComponent implements OnInit, OnDestroy { timeout: number; @Input() useAnchor: boolean; + @Input() + onFocusOnly: boolean; constructor(private map: MapComponent) {} diff --git a/projects/ngx-openlayers/src/lib/map.component.ts b/projects/ngx-openlayers/src/lib/map.component.ts index bab66eb9..082efb0f 100644 --- a/projects/ngx-openlayers/src/lib/map.component.ts +++ b/projects/ngx-openlayers/src/lib/map.component.ts @@ -20,7 +20,7 @@ import { Interaction } from 'ol/interaction'; @Component({ selector: 'aol-map', template: ` -
+
`, }) @@ -44,6 +44,8 @@ export class MapComponent implements OnInit, AfterViewInit, OnChanges { logo: string | boolean; @Input() renderer: 'canvas' | 'webgl'; + @Input() + tabindex: number = null; @Output() olClick: EventEmitter;