@@ -6,7 +6,15 @@ import { transition } from '../../animation';
66import { Component } from '../../core' ;
77import { Group , Rect , Text } from '../../shapes' ;
88import type { Selection } from '../../util' ;
9- import { getEventPos , ifShow , parseSeriesAttr , select , subStyleProps , superStyleProps , toPrecision } from '../../util' ;
9+ import {
10+ getEventViewportPos ,
11+ ifShow ,
12+ parseSeriesAttr ,
13+ select ,
14+ subStyleProps ,
15+ superStyleProps ,
16+ toPrecision ,
17+ } from '../../util' ;
1018import type { SparklineStyleProps } from '../sparkline' ;
1119import { Sparkline } from '../sparkline' ;
1220import { CLASS_NAMES , HANDLE_DEFAULT_CFG , HANDLE_ICON_DEFAULT_CFG , HANDLE_LABEL_DEFAULT_CFG } from './constant' ;
@@ -556,7 +564,7 @@ export class Slider extends Component<SliderStyleProps> {
556564 private onDragStart = ( target : string ) => ( e : any ) => {
557565 e . stopPropagation ( ) ;
558566 this . target = target ;
559- this . prevPos = this . getOrientVal ( getEventPos ( e ) ) ;
567+ this . prevPos = this . getOrientVal ( getEventViewportPos ( e ) ) ;
560568 const { x, y } = this . availableSpace ;
561569 const { x : X , y : Y } = this . getBBox ( ) ;
562570 this . selectionStartPos = this . getRatio ( this . prevPos - this . getOrientVal ( [ x , y ] ) - this . getOrientVal ( [ + X ! , + Y ! ] ) ) ;
@@ -565,11 +573,11 @@ export class Slider extends Component<SliderStyleProps> {
565573 document . addEventListener ( 'pointerup' , this . onDragEnd ) ;
566574 } ;
567575
568- private onDragging = ( e : any ) => {
576+ private onDragging = ( e : PointerEvent ) => {
569577 const { slidable, brushable, type } = this . attributes ;
570578 e . stopPropagation ( ) ;
571579
572- const currPos = this . getOrientVal ( getEventPos ( e ) ) ;
580+ const currPos = this . getOrientVal ( getEventViewportPos ( e ) ) ;
573581 const diffPos = currPos - this . prevPos ;
574582
575583 if ( ! diffPos ) return ;
0 commit comments