vis-timeline icon indicating copy to clipboard operation
vis-timeline copied to clipboard

Is there a way to show a cursor when mouse is hover on the timeline

Open PorterNan opened this issue 1 year ago • 3 comments

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:

  1. Listen to mouse hover event on timeline
  2. Get the time stamp
  3. 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 .

PorterNan avatar Sep 08 '23 18:09 PorterNan

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)

esemplare avatar Sep 23 '23 02:09 esemplare

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

PorterNan avatar Sep 23 '23 05:09 PorterNan

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!

PorterNan avatar Sep 23 '23 05:09 PorterNan