Jump to content
Search Community

Draggable hitTest not working with onThrowUpdate or onThrowComplete

JustAName test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

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.
×
×
  • Create New...