vis-timeline
vis-timeline copied to clipboard
Is there a way to show a cursor when mouse is hover on the timeline
Hi! I've been using timeline for a while and it's been amazing, and now I am trying to implement a cursor(all across groups) and follow the mouse when hovering on timeline all the time. The way I was planning to implement it is:
- Listen to mouse hover event on timeline
- Get the time stamp
- set current time
But I noticed for 1, it only works when you hover on an item not the timeline itself, so wondering if there is a better/simpler way to implement this .
Use mouseMove event to receive an event when the mouse moves within the timeline. See time
and snappedTime
properties of the event.
timeline.on("mouseMove", onMouseMove)
yea... I usied that event, but it feels that event only triggered when mouse is on a item, lemme double check if I just got a wrong memory
Just validated that and it works! Thanks for sharing that code snippet, there is one more interesting question comes up now, when I call timelineInstance?.addCustomTime(event.time); it create a dragabble line which always stay under my mouse, so I can do any other operation like click and drag for other items
Is there a solution for this?
setCurrentTime looks fine, but it is moving all the time, if there is a way to pause it as it is, that would be nice as well!