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

Improve drag&drop

Open Antoine38660 opened this issue 6 years ago • 3 comments

Hi @yotamberk and thanks for having forked this Timeline module from Vis ! 😄

I want to improve timeline-plus by adding the ability to "snap" non-timeline-item to the timeline when dragging.

In other words, I want to :

  • add a "temporary item" when dragEnter in the timeline
  • move it on the timeline like a real one
  • set it as a real one if I drop it on the timeline OR remove it if I drop it outside.

I found in the code a beggining of implementation https://github.com/yotamberk/timeline-plus/blob/master/lib/timeline/Core.js#L302 (I think). Can you give me hints to develop this feature ? (and make a PR to improve the lib of course 😄 )

Antoine38660 avatar Oct 12 '18 08:10 Antoine38660

Hey Yotam, Do you have some tips for this one ?

Cheers 😄

Antoine38660 avatar Nov 12 '18 08:11 Antoine38660

I would start with hooking new behavior to the 'mousedown' event on the ItemSet component and check if you have data on the drag handler, and make sure that as long as the mousedown is still on, that an item is still selected and moved on the timeline while mousemove is triggered. I think the temporary item should be added as a regular item with different CSS and is changed to a normal item only once the 'drop' event is triggered.

Does this help?

yotamberk avatar Nov 17 '18 14:11 yotamberk

Your comment helps me a lot! I'll try to implement that, this week. I keep you up to date.

Antoine38660 avatar Nov 26 '18 09:11 Antoine38660