@@ -282,9 +282,6 @@ function InnerGraph<T extends ReadonlyArray<number | null>>({
282282 )
283283 )
284284
285- let isMaybePanning = true
286- let pendingPointerMove : ReturnType < typeof setTimeout > | null = null
287- const pendingTimeMs = 60
288285 svg
289286 . on (
290287 'pointermove' ,
@@ -296,42 +293,20 @@ function InnerGraph<T extends ReadonlyArray<number | null>>({
296293 const closestIndexToPointer = inHoverableArea
297294 ? getClosestIndexToPointer ( xPointer )
298295 : null
299- const commit = ( ) => {
300- isMaybePanning = false
301- handleDotsForClosestIndex ( closestIndexToPointer )
302- onPointerMove ( {
303- inHoverableArea : true ,
304- closestIndex : closestIndexToPointer ,
305- x : xPointer ,
306- y : yPointer ,
307- event
308- } )
309- }
310- if ( pendingPointerMove ) {
311- clearTimeout ( pendingPointerMove )
312- }
313- const { movementX, movementY, pointerType } = event as PointerEvent
314- if (
315- isMaybePanning &&
316- pointerType === 'touch' &&
317- Math . abs ( movementY ) >= Math . abs ( movementX ) &&
318- inHoverableArea
319- ) {
320- pendingPointerMove = setTimeout ( commit , pendingTimeMs )
321- } else {
322- commit ( )
323- }
296+ handleDotsForClosestIndex ( closestIndexToPointer )
297+ onPointerMove ( {
298+ inHoverableArea : true ,
299+ closestIndex : closestIndexToPointer ,
300+ x : xPointer ,
301+ y : yPointer ,
302+ event
303+ } )
324304 } ,
325305 { passive : true }
326306 )
327307 . on (
328- 'pointerleave' ,
308+ 'lostpointercapture pointerleave' ,
329309 ( ) => {
330- if ( pendingPointerMove ) {
331- clearTimeout ( pendingPointerMove )
332- pendingPointerMove = null
333- }
334- isMaybePanning = true
335310 handleDotsForClosestIndex ( null )
336311 onPointerLeave ( )
337312 } ,
@@ -340,9 +315,6 @@ function InnerGraph<T extends ReadonlyArray<number | null>>({
340315 . attr ( 'opacity' , 1 )
341316
342317 return ( ) => {
343- if ( pendingPointerMove ) {
344- clearTimeout ( pendingPointerMove )
345- }
346318 svg . selectAll ( '*' ) . remove ( )
347319 }
348320 } , [
@@ -365,6 +337,7 @@ function InnerGraph<T extends ReadonlyArray<number | null>>({
365337 return (
366338 < svg
367339 onClick = { onClick }
340+ onPointerUp = { onClick }
368341 ref = { svgRef }
369342 viewBox = { `0 0 ${ width } ${ height } ` }
370343 className = { classNames ( 'w-full h-auto [touch-action:pan-y]' , className ) }
0 commit comments