Gui.pick_node on clipped content

Hi

I’m trying to make clickable item inside a custom gui scroll component.

The problem is when a clickable content is clipped and not shown on view, but gui.pick_node still returns true.

Which doesn’t make sense from user perspective as they can an item that is not visible / outside the scroll view

Is there any way to detect whether a gui item is not shown (clipped)?

thank you for the help

There is no api for this, no.

The Druid have this kind of checks for stencil nodes

To make this works by your own, you should:

  1. Find and remember closest stencil node for your node (https://github.com/Insality/druid/blob/master/druid/helper.lua#L321)
  2. In the place you do the gui.pick_node() also you should check against this stencil node if exists
3 Likes

Thank you for the reply

I’m trying to create my own implementation. Is there anyway to check whether a node is outside clipped stencil / outside the view of the clip node?

You can use gui.get_parent() and do it recursively. If at the end (no more parent node), you don’t see any node with stencil mode, your checking node is outside any clipped stencil node