almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Timeline: onMoving callback seems to prevent items from visually moving #4181

Closed galinaskaya closed 5 years ago

galinaskaya commented 5 years ago

I'm working on a project that uses the onMove callback function. Recently I was investigating a way to add a dynamic timestamp on each item (that updates as the item is moved around on the timeline, before it's dropped) and tried using the onMoving function for that. However, when I added that function to the code, I noticed that the items on the timeline were no longer visually moving. There is no way to "pick up" the item and start moving it.

Interestingly enough, both the onMove and the onMoving functions are still firing; however, visually the item does not move on the timeline. This also seems to happen when only onMoving is used.

Made a simple JS Bin to illustrate the issue here: JS Bin

Tried Chrome, Safari, and Firefox on macOS High Sierra.

brichbe commented 5 years ago

Take a look at the code for this example that uses callbacks. You have to invoke the callback(item) if you want the item's movement to succeed; otherwise, by leaving out that callback (like your jsbin does), or by invoking callback(null), you're telling the Timeline to cancel those user actions (prevent the item's movement).