diff --git a/src/chart/inputlisteners/canvas-input-listener.component.ts b/src/chart/inputlisteners/canvas-input-listener.component.ts index e0686f7e..0c5fcf4e 100644 --- a/src/chart/inputlisteners/canvas-input-listener.component.ts +++ b/src/chart/inputlisteners/canvas-input-listener.component.ts @@ -64,7 +64,7 @@ export class CanvasInputListenerComponent extends ChartBaseElement { private pinchSubject = new Subject(); private scrollGestureSubject = new Subject(); - private fastScrollTouch = new Subject(); + private fastTouchScroll = new Subject(); mouseLeavesCanvasSubject = new Subject(); @@ -301,7 +301,7 @@ export class CanvasInputListenerComponent extends ChartBaseElement { // because landscape and portait orientations would give different % results const minDistance = 35; // in ms, should be lower to detect as "fast" - const maxTime = 200; + const maxTime = 250; const touchStartTs = this.touchStartTimestamp; const touchEndTs = Date.now(); @@ -312,7 +312,7 @@ export class CanvasInputListenerComponent extends ChartBaseElement { const isRightTime = time <= maxTime; if (isRightDistance && isRightTime) { - this.fastScrollTouch.next(e); + this.fastTouchScroll.next(e); } } }; @@ -831,10 +831,12 @@ export class CanvasInputListenerComponent extends ChartBaseElement { * Returns an Observable that emits a Touch whenever a fast scroll is detected. * Fast scroll happens whenever chart or any other pane were moved faster than usual * The Observable is created from a Subject that is subscribed to by the component's template. - * @returns {Observable} An Observable that emits a TouchEvent whenever a fast scroll gesture is detected. + * @returns {Observable} An Observable that emits a TouchEvent whenever a fast scroll is detected. */ - public observeFastScrollTouch(): Observable { - return this.fastScrollTouch.asObservable(); + public observeFastTouchScroll(hitBoundsTest: HitBoundsTest = () => true): Observable { + return this.fastTouchScroll + .asObservable() + .pipe(filter(() => hitBoundsTest(this.currentPoint.x, this.currentPoint.y))); } /**