These are chat archives for taye/interact.js

14th
Jul 2015
calebroseland
@calebroseland
Jul 14 2015 13:29
This message was deleted
calebroseland
@calebroseland
Jul 14 2015 13:39

Hey everyone,
Does anyone know if it is possible to recalculate the snap targets after a draggable has been set up?
I can sort of hack it in and modify the snap targets by overwriting them during the dragStart event, but this doesn't seem very clean and I lose the simple snap API.

Any help would be greatly appreciated!

$$

$$

calebroseland
@calebroseland
Jul 14 2015 13:50
interact("someEle").draggable({
      snap: {
        targets: [], //targets here, need to recalculate on dragStart
        relativePoints: [], //rel points here
        offset: { 
          x: 0, //canvas.offsetLeft + pageList.scrollLeft
          y: 0 //canvas.offsetTop + pageList.scrollTop
        }

      }
});
loverdrive
@loverdrive
Jul 14 2015 14:33

@calebroseland , try adding

event.draggable.draggable({
                snap: {
                    targets: [<new_target_coords>]
                }
            });

when you want to change target