GUI clipChildren pointer events


#1

Heeey folks :slightly_smiling_face:

I recently upgraded my project to use latest version of BJS because clipChildren feature was added to GUI and it seemed like something i really could use.

However i can’t seem to make the “unclipped” children receive pointer events.

playground example: https://www.babylonjs-playground.com/#7RH606#2

I don’t know if this would be considered feature request or a bug report, or am i just doing something wrong, but it would be cool if these unclipped children could be clicked.

Thanks for your time :slightly_smiling_face:


#2

I’m not sure buttons are supposed to support seperate click events on it’s children, (@Deltakosh ? )
but there does indeed seem to be a bug with event’s not firing on “unclipped” children in general.

// Clicking on upper edge of button (within container) works, lower/“clipped” area doesn’t.
https://www.babylonjs-playground.com/index.html#7RH606#3

.
Moved topic to bugs.


#3

Well this how it is supposed to work unfortunately.
The Button (the container) will intercept events only on its rectangle area. If you decide to add out of area children, they won’t receive the click event.

You may need to create a bigger button that will encapsulate all its children (or group the button and the rect in a grid so both can receive events)


#4

Yeah i thought that might be the case (which is why i didn’t post this in the bugs category).

Creating bigger invisible “meta” rectangles is exactly what i have been doing to be able to move/remove multiple items in one.

But it is a bit of a hassle to make and handle this extra object - so when i saw clipChildren added i was excited that we could have the engine do these “meta” rectangles for us automatically.

But yeah, guess i’ll just keep doing those. Should maybe put a note about unclipped children not able to receive input as im sure someone else will try to do the same thing as me :smile:


#5

Ahh, i assumed wrongly then :slight_smile: