taye / interact.js

JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE9+)
http://interactjs.io/
MIT License
12.38k stars 785 forks source link

snapping into relative current position. #174

Closed senthilkumarpn closed 9 years ago

senthilkumarpn commented 9 years ago

Hi Taye,

this is related to the post

https://github.com/taye/interact.js/issues/79

i would need to set if 50% drag Element overlap on dropZone, then i need to place the element inside the dropzone relative to the current position (not to snap to center). thanks in advance. untitled untitled

Your quick reply will be much helpfull for me

taye commented 9 years ago

This is possible if you use the methods documented at http://interactjs.io/docs/ and http://interactjs.io/api/ and add code to perform your desired response to drop or dragend events.

senthilkumarpn commented 9 years ago

Thanks for your comment. and i fixed the snapping. i'm facing performance issue on ie11 windows 8. below is my dragMove code and the same works smoothly in iOs 8 without any performance issue. altimately my goal is to drag & drop three Obj concurrently. sometimes it can not be drag while i drag little bit faster on ie11.

Is there any way to optimize on IE and to restart the draggables incase if it is struck at somewhere.

ie drag performace issue

sample jsFiddle link: http://jsfiddle.net/senthilkumarpn/37y1kzxb/

function dragMoveListener (event) { var target = event.target, x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx, y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy; target.style.webkitTransform = target.style.transform ='translate(' + x + 'px, ' + y + 'px)'; target.setAttribute('data-x', x); target.setAttribute('data-y', y);

}

taye commented 9 years ago

Is there any way to optimize on IE

I don't know.

and to restart the draggables incase if it is struck at somewhere.

The API doesn't provide a way to do that. You would need to implement that yourself.