@@ -243,31 +243,32 @@ export default class ChartAdapterStore {
243
243
chartNode &&
244
244
this . scrollableChartParent &&
245
245
! this . mainStore . state . isVerticalScrollEnabled &&
246
- e . touches . length === 1
246
+ e . changedTouches . length === 1
247
247
) {
248
- const { pageX, screenX , screenY } = e . touches [ 0 ] ;
248
+ const { pageX, pageY } = e . changedTouches [ 0 ] ;
249
249
if ( [ 'touchstart' , 'touchend' ] . includes ( e . type ) ) {
250
- this . touchValues = e . type === 'touchstart' ? { x : screenX , y : screenY } : { yOnTouchEnd : screenY } ;
250
+ this . touchValues = e . type === 'touchstart' ? { x : pageX , y : pageY } : { yOnTouchEnd : pageY } ;
251
251
} else if ( e . type === 'touchmove' ) {
252
252
const nonScrollableAreaWidth = chartNode . offsetWidth - this . mainStore . chart . yAxisWidth ;
253
253
const { left } = chartNode . getBoundingClientRect ( ) ;
254
254
255
255
if ( this . touchValues . x && this . touchValues . y ) {
256
- const deltaX = Math . abs ( screenX - this . touchValues . x ) ;
257
- const deltaY = Math . abs ( screenY - this . touchValues . y ) ;
256
+ const deltaX = Math . abs ( pageX - this . touchValues . x ) ;
257
+ const deltaY = Math . abs ( pageY - this . touchValues . y ) ;
258
258
const isVerticalScroll = deltaY > deltaX ;
259
259
const x = pageX - left ;
260
260
if ( x < nonScrollableAreaWidth && isVerticalScroll && ! this . scrollChartParentOnTouchTimer ) {
261
261
this . touchValues . yOnTouchEnd = undefined ;
262
262
this . scrollChartParentOnTouchTimer = setTimeout ( ( ) => {
263
263
this . scrollableChartParent ?. scrollBy ( {
264
- top : screenY - Number ( this . touchValues . yOnTouchEnd ?? this . touchValues . y ) ,
264
+ top : pageY - Number ( this . touchValues . yOnTouchEnd ?? this . touchValues . y ) ,
265
+ behavior : 'smooth' ,
265
266
} ) ;
266
267
this . scrollChartParentOnTouchTimer = undefined ;
267
- } , 300 ) ;
268
+ } , 100 ) ;
268
269
}
269
270
}
270
- this . touchValues = { x : screenX , y : screenY } ;
271
+ this . touchValues = { x : pageX , y : pageY } ;
271
272
}
272
273
}
273
274
}
0 commit comments