Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to onFocusOnly option for interactions #260

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -9,11 +9,13 @@ import { MapComponent } from '../map.component';
})
export class DefaultInteractionComponent implements OnInit, OnDestroy {
instance: Collection<Interaction>;
@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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export class DragPanInteractionComponent implements OnInit, OnDestroy {
condition: Condition;
@Input()
kinetic: Kinetic;
@Input()
onFocusOnly: boolean;

constructor(private map: MapComponent) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class MouseWheelZoomInteractionComponent implements OnInit, OnDestroy {
timeout: number;
@Input()
useAnchor: boolean;
@Input()
onFocusOnly: boolean;

constructor(private map: MapComponent) {}

Expand Down
4 changes: 3 additions & 1 deletion projects/ngx-openlayers/src/lib/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Interaction } from 'ol/interaction';
@Component({
selector: 'aol-map',
template: `
<div [style.width]="width" [style.height]="height"></div>
<div [style.width]="width" [style.height]="height" [attr.tabindex]="tabindex"></div>
<ng-content></ng-content>
`,
})
Expand All @@ -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<MapBrowserEvent>;
Expand Down