vue-drag-resize
vue-drag-resize copied to clipboard
[Feature Request] Separate Instance Snap To
It would be nice if there were a way to make separate vue-drag-resize instances snap to one another if their edges get close.
I believe that it's hard to implement because as you said, instances are separate.
maybe you should try in another way: maintain a Object Array like follows
ObjectArr: [
{
left: 10,
top: 50,
width: 200,
height: 200,
active: false,
},
{
left: 300,
top: 500,
width: 200,
height: 200,
active: false,
},
{
left: 700,
top: 900,
width: 200,
height: 200,
active: true,
}]
then, when you moves one certain instance, a function will be called to calculate the edges of the active instances and the inactive instances, it depends on your own requirements. it may look like as follows
if( instancesClose(instance, ObjectArr) ) { instance.left = ObjectArr[0].width + ObjectArr[0].left }