Skip to content

Commit

Permalink
fix(draggable): works again
Browse files Browse the repository at this point in the history
  • Loading branch information
Wykks committed Jan 23, 2018
1 parent 6ad4526 commit 9ae98df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/app/lib/source/geojson/draggable.directive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Directive, Host, Input, OnDestroy, OnInit } from '@angular/core';
import { MapMouseEvent } from 'mapbox-gl';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { merge } from 'rxjs/observable/merge';
import { takeUntil } from 'rxjs/operators/takeUntil';
import { ReplaySubject } from 'rxjs/ReplaySubject';
Expand Down Expand Up @@ -44,11 +46,11 @@ export class DraggableDirective implements OnInit, OnDestroy {
}
this.MapService.changeCanvasCursor('move');
this.MapService.updateDragPan(false);
this.MapService.mapEvents.mouseDown.pipe(
fromEvent(this.MapService.mapInstance, 'mousedown').pipe(
takeUntil(merge(this.destroyed$, this.source.mouseLeave))
).subscribe(() => {
this.MapService.mapEvents.mouseMove.pipe(
takeUntil(merge(this.destroyed$, this.MapService.mapEvents.mouseUp))
fromEvent<MapMouseEvent>(this.MapService.mapInstance, 'mousemove').pipe(
takeUntil(merge(this.destroyed$, fromEvent(this.MapService.mapInstance, 'mouseup')))
).subscribe((evt) => {
this.FeatureComponent.updateCoordinates([evt.lngLat.lng, evt.lngLat.lat]);
});
Expand Down

0 comments on commit 9ae98df

Please sign in to comment.