rotaready / moment-range

Fancy date ranges for Moment.js
The Unlicense
1.69k stars 202 forks source link

Set item.Start at current mouse position on drop item over timeline #270

Open neoburgos opened 4 years ago

neoburgos commented 4 years ago

Hello. (sorry if I explain myself wrong)

I´m using this example: https://visjs.github.io/vis-timeline/examples/timeline/other/drag_drop.html

In this code: https://pastebin.com/Pg0JRsfG

I want drop an item with: start time : same I get when I do:

timeline.on('drop', function (properties) { console.log('time at this point: '+properties.time); });

end time : start time + something (no problem here)

function handleDragStart(event) { var dragSrcEl = event.target; event.dataTransfer.effectAllowed = 'move'; var item = { id: new Date(), type: 'range', content: event.target.innerHTML.trim() }; item.start = WHAT CAN I USE HERE? item.end = new Date(10006060 + (new Date()).valueOf()); event.dataTransfer.setData("text", JSON.stringify(item)); }