Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

slopps

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

16 Newbie

About slopps

  • Rank
    Newbie

Recent Profile Visitors

1,355 profile views
  1. Thank you Blake! That's a great point about binding, that should've occurred to me. Great points on the scoping too; thank you for pointing that out. That was due to porting this as quickly as possible to codepen from a component that exists within a larger app, where the "this" context is referring to the component which is encapsulated within a commonjs module, which is created using new. I admittedly did a poor job on the pen... Thanks so much for the quick and thorough response!
  2. Solved. While the PointerEvent target is still showing non-Draggable, I was able to stop the errors by setting this.$currentDragItem in onDragPress instead of onDragStart. I now realize this is not an issue with Draggable as is it is merely passing along the PointerEvent, which is reflecting what the mouse is currently over. I'm also scoping my callbacks differently so that I'm not able to get the draggable instance from 'this'. If scoped normally, you wouldn't need to rely on the PointerEvent to get the current drag item, as you could use 'this' to get the Draggable inst
  3. Very rarely, about 1 out of 100 times (sometimes you have to re-run the pen even), if you try to drag these items around very rapidly (as in click, drag, release and immediately click and drag again, over and over) Edit: to replicate consistently, place the mouse on the last pixel on any edge of DragItem1 (so the very first pixel where your mouse turns into a drag icon), then drag away from that edge (so if you choose bottom edge, drag downward). You will see via the console logs that the PointerEvent target inside onDragStart is a totally non-draggable element. In the onDragPress, t
  4. If you look at the docs, one of the examples says //checks if at least 50% of the surface area of either element is overlapping: if (this.hitTest("#element3", "50%")) { //do stuff } therefore, it checks if 50% of either element is overlapping with the other
  5. You're right on both accounts. I was going to argue that it was being calculated anyway, but looking at the hitTest implementation I see that the area is only calculated if a ratio is passed. Perhaps it could become a new function, getOverlapArea or some such? It goes without saying, I defer to you as this is one of the most well made libraries I've used (thank you, btw!). Not sure if percentage would be as necessary since area could also be used for comparison between the drop-zones to determine dropspot "most-over." In the meantime, if anyone needs it you could get the overlap area o
  6. I would actually argue that the hitTest() function should return a percentage rather than a boolean. The percentage would represent the overlap. 0 would mean no hit detected, anything above zero would represent the percentage of overlap. This would be useful when the item was touching multiple drop spots, when you want to know which drop spot the drag item was most over.
  7. Thank you! Seems to work very nicely even with the animation. I was initially not willing to change the transform origin due to other constraints, but they're easier to work around than this would otherwise be. I will note, if you rotate the drag item in addition to scaling, this stops working as expected. Fortunately I was able to talk my project managers into getting rid of the rotation. Thank you again
  8. Just finished making these two short codepens to demonstrate. This Draggable has a separate drag handle for the drag item, and on release it scales the entire drag item up. If you click on the handle while it's scaled up, I want the item to shrink back to it's normal size only while you are dragging. However, I can't figure out how to make it stay under your mouse where you actually clicked the handle. codepen 1 - instantly scale-down: http://codepen.io/anon/pen/VerJdJ codepen 2 - animate scale-down (this is what i would prefer if possible): http://codepen.io/anon/pen/JGOQYZ I tho
×