Jump to content
Search Community

Draggable item that is below scroll doesn't properly resolve hitTest when released

7linternational test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Ok so this is a continuation of my previous post (that was resolved) 


The problem now is that when the item that exists below the fold (you have to scroll to reach it), when dragged the draggable on the `move` function will correctly resolve hitTest versus other containers, but on dragEnd it will not resolve hitTest correctly. Other list elements that are above the scrollbar correctly resolve hitTest on both `move` and `dragEnd`

Here is a sample: https://stackblitz.com/edit/gsap-react-basic-f48716-tc3dev?file=src%2FBoxItem.js  
(simply drag box 3, 4 over the drop area and release, the hit test resolves correctly, then drag box 7 on move it will fire the hitTest correctly, but when released over the drop-area the hitTest will return false)

Link to comment
Share on other sites

  • Solution

That's because you're altering the overflow first, which effectively moves everything, and THEN you're hit-testing, thus it has already shifted at that point. It's just a logic thing. Move your code so that it executes in the proper order to avoid that: 

https://stackblitz.com/edit/gsap-react-basic-f48716-2x3xdu?file=src%2FBoxItem.js

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