[Feature Request] Separate Instance Snap To

This issue has been tracked since 2021-04-29.

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.

pinkcao wrote this answer on 2021-05-06

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
}

More Details About Repo
Owner Name kirillmurashov
Repo Name vue-drag-resize
Full Name kirillmurashov/vue-drag-resize
Language JavaScript
Created Date 2018-04-26
Updated Date 2022-11-25
Star Count 1764
Watcher Count 24
Fork Count 291
Issue Count 89

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date