Jump to content
Search Community

hit test not working on newly visible element

Xristi 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

Hello. I have 3 different grids containing the same elements in the same configuration. They occupy the same position on the page and their presentation is controlled through style.visibility (either visible or hidden) with none of the grids showing initially. I use Draggable functionality in which the draggable elements are positioned absolutely and the drop areas are positioned relatively. My trial version drag and drop hit-test works just fine but it has just one of the grids and it is visible from the start of the page presentation. The actual page described previously does not register the hit-test and the DnD element always returns to its home. I'm thinking perhaps scope for "this" needs to be defined but can't seem to find any documention on how to do it. I have tried "focus" on the grid presently showing but that didn't work. This is a Draggable create situation with "this.hitTest" and the drop area element has been thoroughly checked. Going on a day and half trying to figure it out. I'm learning by doing and most probably am missing a simple concept. I would be grateful for any ideas, information, or instruction.

Link to comment
Share on other sites

Thank you for your replies. Before including the DnD functionality (using draggable elements that are absolutely positioned in a relatively positioned grid) on the main page I created an abbreviated trial page. It works fine. When transferred to the main page, though, the hittest no longer fires even though all elements have identical id's and css properties. I just thought that there might be a scope issue with "this" as there is mention of onDragEndScope in the documentation but there is no "+" to click on for more information.

 

Again, I am grateful for all of your help over the years but sending a minimal codePen wouldn't seem to help much...

 

I'm in the process of comparing the two instances to find the anomaly causing the problem.

 

Thanks again.

Link to comment
Share on other sites

Yes... for sure. But the conflict exists in the larger page - not something I would expect anyone to dig through :-)

 

I'll just keep whittling away. If it does get down to a manageable codePen and I haven't found the problem I'll send a codePen at that point. Many thanks!!

Link to comment
Share on other sites

6 hours ago, Xristi said:

I just thought that there might be a scope issue with "this" as there is mention of onDragEndScope in the documentation but there is no "+" to click on for more information.

 

Does your callback use this.hitTest? If so, don't mess with the scope.

 

You said it can't hit test a newly visible element. console.log the element to make sure you are actually hit testing something. 

 

  • Like 2
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...