xzdarcy / react-timeline-editor

react-timeline-editor is a react component used to quickly build a timeline animation editor.
https://zdarcy.com/
MIT License
284 stars 82 forks source link

Add onClickCursor and onDoubleClickCursor events #28

Open prismosoft opened 1 year ago

prismosoft commented 1 year ago

Hi @xzdarcy, Great job on this very useful timeline editor, loving it!

Is it possible to add 2 more simple events, onClickCursor and onDoubleClickCursor ?

Here is what's happening:

I am using onClickActionOnly and using the time parameter to set the current time whenever an action is clicked. This works well.

I also use the onDoubleClickAction to trigger something else.

The problem is, on the first click, the time gets updated, and the cursor is being updated and placed just below where the second click is happening. So the double click event is not being triggered, the cursor is being clicked instead. So unless I remove my setTime function from within the onClickActionOnly event, the onDoubleClickAction is being ignored.

So I thought, if you could add events on the cursor as well, I could use those instead. Unless there is another way...

prismosoft commented 1 year ago

I actually fixed the problem by adding a transition to the cursor! It's actually a nice transition, and the double click works because it happens before the end of the transition 👍

.timeline-editor-cursor {
    transition: left 0.3s;
}