vue-moveable
vue-moveable copied to clipboard
Unable to use groups after initialization
Based on the Moveable documentation (found here: https://github.com/daybrush/moveable/blob/0.13.4/handbook/handbook.md#toc-group), you can create a group of moveable elements by passing an array to the target property. However, doing so in vue-moveable after initialization throws the following error:
Uncaught (in promise) TypeError: Cannot read property 'addEventListener' of undefined
I've confirmed that this occurs no matter the type of elements. It's present with both div and svg. Additionally, if the array has only a single element in it, this error does not occur.
Demo: https://codesandbox.io/s/vue-moveable-group-problem-9r6sf?fontsize=14&hidenavigation=1&theme=dark
Vue-Moveable version: 1.4.0
Hi @dartanian300 👋
Thanks for your issue. Groups are not supported right now. Some work was done in v1.6.0 to make it work properly but it still needs testing
Any updates on when groups will be supported? I am having the same issue unfortunately. Digging into this package and moveable package to figure out why it's doing this. While debugging, it turns out that nextTarget is null because dragTarget and areaElement are both null -- this leads to the Uncaught (in promise) TypeError: Cannot read property 'addEventListener' of undefined error. This is in the updateEvent function for MoveableGroup in the Moveable package.

Finally figured out what the problem was. Boolean props have a default value of False. This was screwing everything up. I replaced every Boolean prop value from Boolean to {type: Boolean, required: false, default: undefined } in Moveable.vue component, and it worked! So I believe that's the fix that needs to be made in this package for groups to work.