Jump to content
GreenSock

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

hit test not working on newly visible element

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.

Share this post


Link to post
Share on other sites

Hey @Xristi,

 

Learning by doing may be helpful.
Helping by seeing a demo too.
So show us your case in a codePen.

 

Kind regards

Mikel

  • Like 2

Share this post


Link to post
Share on other sites

As mikel suggests, it is very hard for us to help with scoping issues like this without seeing a (minimal) demo of the issue. A CodePen as the thread below suggests is a great place to host the demo!

 

 

  • Like 1

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

There's got to be a conflict happening somewhere, but without the ability to see it, it's impossible for us to help you.

Share this post


Link to post
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!!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×