88 */
99
1010import * as React from 'react' ;
11- import { memo , useCallback } from 'react' ;
11+ import { memo } from 'react' ;
1212import { areEqual } from 'react-window' ;
1313import { getGradientColor , formatDuration , formatTime } from './utils' ;
1414
@@ -39,11 +39,6 @@ function SnapshotCommitListItem({data: itemData, index, style}: Props) {
3939 const commitDuration = commitDurations [ index ] ;
4040 const commitTime = commitTimes [ index ] ;
4141
42- const memoizedSelectCommitIndex = useCallback (
43- ( ) => selectCommitIndex ( index ) ,
44- [ index , selectCommitIndex ] ,
45- ) ;
46-
4742 // Guard against commits with duration 0
4843 const percentage =
4944 Math . min ( 1 , Math . max ( 0 , commitDuration / maxDuration ) ) || 0 ;
@@ -52,14 +47,17 @@ function SnapshotCommitListItem({data: itemData, index, style}: Props) {
5247 // Leave a 1px gap between snapshots
5348 const width = parseFloat ( style . width ) - 1 ;
5449
55- const handleMouseDown = ( e : any ) => {
56- memoizedSelectCommitIndex ( ) ;
57- const rect = e . target . getBoundingClientRect ( ) ;
58- startCommitDrag ( {
59- dragStartCommitIndex : index ,
60- rectLeft : rect . left ,
61- width,
62- } ) ;
50+ const handleMouseDown = ( { buttons, target} : any ) => {
51+ if ( buttons === 1 ) {
52+ selectCommitIndex ( index ) ;
53+
54+ // TODO Count for border/margin
55+ startCommitDrag ( {
56+ commitIndex : index ,
57+ left : target . getBoundingClientRect ( ) . left ,
58+ sizeIncrement : parseFloat ( style . width ) ,
59+ } ) ;
60+ }
6361 } ;
6462
6563 return (
0 commit comments