yotamberk / timeline-plus

Timeline - chronological visualization of your data
MIT License
137 stars 36 forks source link

trapping long press #142

Closed pliablepixels closed 5 years ago

pliablepixels commented 5 years ago

Hi, thanks for your effort in forking timeline. I've been using visjs for a long time and just noticed its EOL and migrated to your library.

I had a specific question: How exactly does one detect long press on an item?

I have a situation where I need the solution to run on both mobile and desktop. On desktop, I use the on('mouseOver') event to display some information as the pointer moves around the graph. On mobiles, this option is not available, so I was interested in being able to trap the "long press" event, but I don't see an event for it.

I've tried on(select) (my items are selectable) but that callback is never invoked (this may be because I also use click and double click handlers for different actions which work well). I also saw that one could use the hammer object underlying it, but I don't see exactly how to use it. I tried

timeline_instance.hammer.on('<specific event>') but that was never fired.

thanks.

pliablepixels commented 5 years ago

And just as I posted this, select starts to work...