Live data from Hacker News

Interact.js – drag and drop, resizing and multi-touch gestures

github.com

11–20 of 37 posts

Re: Interact.js – drag and drop, resizing and multi-touch gestures

#15
The second example needs some more work.

When you drag no-drop over the yes-drop div it appears on top. If you then drag yes-drop and go back to dragging the no-drop this then appears under the yes-drop div.

Also I don't get what causes the highlight of the drop zones to activate. Percentage of shape? Center of Shape? Personally I prefer that it is the mouse pointer that activates the enter / leave and not the shape itself.

Added: If you drag the yes-drop from the side to enter the drop zones, the outer zone looks like 50 pixels wide and yet the error or margin to drop it in there is about 2 pixels before you enter the inner zone.

Re: Interact.js – drag and drop, resizing and multi-touch gestures

#17

It's neat but on Android Chrome the areas that accept taps/drags/pinches/etc. consume swipe/drag to scroll events which means you have to create lanes or something on long pages(like the interactjs.io page itself).

Yep, saw the same thing. Everything works nicely but on a small screen you can get into situations where you can't scroll the page unless you drag the very edge.

Re: Interact.js – drag and drop, resizing and multi-touch gestures

#19
Looks really nice and worked really well in my S5. The one issue I had was with the multi-touch rotation example, you're not able to touch and scroll up with your fingers if you touch in the background. The resizing example isn't as bad but doesn't seem to register the first time you touch+drag either.

Re: Interact.js – drag and drop, resizing and multi-touch gestures

#20

The second example needs some more work. When you drag no-drop over the yes-drop div it appears on top. If you then drag yes-drop and go back to dragging the no-drop this then appears under the yes-drop div. Also I don't get what causes the highlight of the drop zones to activate. Percentage of shape? Center of Shape? Personally I prefer that it is the mouse pointer that activates the enter / leave and not the shape…

> When you drag no-drop over the yes-drop div it appears on top. If you then drag yes-drop and go back to dragging the no-drop this then appears under the yes-drop div.

This is because before dragging, there's no CSS transform style. After dragging the transformation causes the element to be rendered above its siblings. Then when the other element is transformed it is then rendered above. I've added

  transform: translate(0px, 0px);
to both elements to fix that.

> Also I don't get what causes the highlight of the drop zones to activate. Percentage of shape? Center of Shape? Personally I prefer that it is the mouse pointer that activates the enter / leave and not the shape itself.

It's mentioned in the JS code comments

  interact('.dropzone').dropzone({
      // only accept elements matching this CSS selector
      accept: '#yes-drop',
      // Require a 75% element overlap for a drop to be possible
      overlap: 0.75,
You could instead set overlap to "pointer".

> Added: If you drag the yes-drop from the side to enter the drop zones, the outer zone looks like 50 pixels wide and yet the error or margin to drop it in there is about 2 pixels before you enter the inner zone.

The deepest dropzone element in the DOM gets drop priority if the element/pointer is over multiple dropzones.

Post reply on HN