Skip to content

Commit

Permalink
feat(map): add wheel event (from mapbox-gl v0.45.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wykks committed May 11, 2018
1 parent 18447f4 commit 8daaebe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/lib/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class MapComponent implements OnChanges, OnDestroy, AfterViewInit, MapEve
@Output() touchEnd = new EventEmitter<MapTouchEvent>();
@Output() touchMove = new EventEmitter<MapTouchEvent>();
@Output() touchCancel = new EventEmitter<MapTouchEvent>();
@Output() wheel = new EventEmitter<any>(); // TODO MapWheelEvent
@Output() moveStart = new EventEmitter<DragEvent>(); // TODO Check type
@Output() move = new EventEmitter<MapTouchEvent | MapMouseEvent>();
@Output() moveEnd = new EventEmitter<DragEvent>();
Expand Down
4 changes: 4 additions & 0 deletions src/app/lib/map/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ export class MapService {
if (events.touchCancel.observers.length) {
this.mapInstance.on('touchcancel', (evt: MapboxGl.MapTouchEvent) => this.zone.run(() => events.touchCancel.emit(evt)));
}
if (events.wheel.observers.length) {
// MapboxGl.MapWheelEvent
this.mapInstance.on('wheel', (evt: any) => this.zone.run(() => events.wheel.emit(evt)));
}
if (events.moveStart.observers.length) {
this.mapInstance.on('movestart', (evt: DragEvent) => this.zone.run(() => events.moveStart.emit(evt)));
}
Expand Down
1 change: 1 addition & 0 deletions src/app/lib/map/map.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface MapEvent {
touchEnd: EventEmitter<MapTouchEvent>;
touchMove: EventEmitter<MapTouchEvent>;
touchCancel: EventEmitter<MapTouchEvent>;
wheel: EventEmitter<any>; // TODO MapWheelEvent
moveStart: EventEmitter<DragEvent>; // TODO Check type
move: EventEmitter<MapTouchEvent | MapMouseEvent>;
moveEnd: EventEmitter<DragEvent>;
Expand Down

0 comments on commit 8daaebe

Please sign in to comment.