You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I´m having a draggable video and want to differentiate double and single taps/clicls.
Currently, I´m doing the following, but it seems not ideal:
Also, it seems that multiple double clicks in short succession often don´t quite work, I wonder if the filterTaps ignores some on short succession.
constbind2=useDrag(dragHandler,{filterTaps: true});constdragHandler=(state)=>{if(state.tap){tapHandler(state)}(...)letlastClick=(newDate()).getTime()consttapHandler=(state)=>{// Click handling// Time since last clickconstmsNow=(newDate()).getTime()constsince_last_click=msNow-lastClicklastClick=msNow// Double click?if(since_last_click<CLICK_INTERVAL){// Double click(videoseekingcode)// Double toggle video statevideoRef.current.toggle()lastClick=0}// Single clickelse{videoRef.current.toggle()}}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I´m having a draggable video and want to differentiate double and single taps/clicls.
Currently, I´m doing the following, but it seems not ideal:
Also, it seems that multiple double clicks in short succession often don´t quite work, I wonder if the filterTaps ignores some on short succession.
Beta Was this translation helpful? Give feedback.
All reactions