Jump to content
GreenSock

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

Draggable hitTest not working with onThrowUpdate or onThrowComplete

Recommended Posts

When using Draggable, the same item that has a passing hitTest with onDragEnd won't work with onThrowUpdate or onThrowComplete.  Is this intended?

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums and Club GreenSock,

 

hitTest() should work the same for all 3 of those callbacks.

I put together a basic example just to do a quick test and I didn't see any problems.

 

Draggable.create(".target", {
        bounds:"#demo",
    throwProps:true,
        type:"x,y",
    onDragEnd:function(){
      if (this.hitTest(".hitTest")){
        console.log("hit onDragEnd");
      }
    },
    onThrowComplete:function(){
      if (this.hitTest(".hitTest")){
        console.log("hit onThrowComplete");
      }
    },
    onThrowUpdate:function(){
      if (this.hitTest(".hitTest")){
        console.log("hit onThrowUpdate");
      }
    }
    }
)

 

See the Pen zdYRLw?editors=0011 by GreenSock (@GreenSock) on CodePen

 

If you are still getting unexpected results. Please provide a reduced test case that clearly illustrates the issue. Its the best way for us to be able to quickly assess the issue and provide a solution. The easiest way to do that would be to:

  1. click the "run pen" button in the demo above
  2. click the "edit on codepen" button
  3. click the fork button to make your own version of my demo
  4. add your code the demo
  5. save
  6. paste the link into your reply

We will be happy to give it a look.

 

Thanks!

 

 

  • Like 4
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.
×