Jump to content
GreenSock

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

Draggable onDragEnd not firing

Recommended Posts

I recently upgraded an app to gsap 3 and found that my Draggable instance never fires its onDragEnd event. The other events (onDragStart and onDrag) fire just fine. 

 

I tried onRelease event also and it doesn't fire either. I'm using React 16.12 and found another post about needing to use dragClickables: true option, but that didn't help. 

 

In case it's relevant, I'm using:

this.draggable.startDrag(originalEvent);

 

to initiate the dragging, as it's a dynamic element that I create rather than one the user touches. 

 

Any ideas?

Link to comment
Share on other sites

Hey geddski and welcome. Thanks for being a Business Green member - we couldn't do what we do without people like you.

 

Can you please create a reduced demo to exemplify this issue? Maybe on Stackblitz or CodeSandbox? It's hard to help blindly. I can't recreate the error solely from your description as seen in the pen below:

See the Pen gObJdXY?editors=0010 by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

no problem I'll try to recreate it in a codepen.

Link to comment
Share on other sites

I found a workaround in case anyone comes across this thread:

 

I add my own mouseup/touchend event to the copy element, and call draggable.endDrag(originalEvent). Here's an updated example:

See the Pen XWJwxEQ by geddski (@geddski) on CodePen

  • Like 1
Link to comment
Share on other sites

Ah, the problem was that you were listening for a mouse event in a browser that supports pointer events which are prioritized in Draggable (and the browser). I've made an adjustment to the next release that should resolve this. Demo: 

See the Pen 90377d50d93801e813f20347c1a2fe13?editors=0010 by GreenSock (@GreenSock) on CodePen

 

A preview of that next release of Draggable can be found at https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/Draggable3.min.js

 

Better? 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×