Element can not click when setting negative scale

I tried to mirror flip the UI element by setting the scale to -1,all seems right expect I can’t click it anymore,the click event just not fire.Is there anyway to slove this?

Indeed I was able to reproduce this, seems to be messing with the picker used to detect clicks on the element. This seems like a bug or missing feature, not sure if negative scales are supported on the elements.

Could you log this on the engine repo? It might have an easy fix.

Would rotating the element 180 degrees be a usable workaround for your element? You may need to set the material culling to “None” or “Front” to make it visible once rotated.

1 Like

The element component should have a flip X/Y attribute added like the Sprite component :thinking:

That seems sensible to me.

I am sorry for the late reply.I am currently working on an urgent project which dosen’t give me a lot of time to solve this problem.so I create two mirror UI element and choose to enable one of them according to the situation:joy:Thanks for your advice,I’ll try that later,hope they can fix it.

1 Like

Thanks for your advice:grinning:
and yes I can rotate the element 180 degrees,but I can’t see any material culling setting in it,since I used textures instead of materials,am I missing something?

Yes, for that to work you have to either use Materials or override the default material used by all elements to enable culling, in code (this can be tricky).

Thanks for you reply:grinning:.but how can I add the flip X/Y attribute to the element component?I only see them in the Sprite component.

I think that is more of a suggestion to the Playcanvas team (@will) to add it as a property to the pc.Element class and expose it to the editor.

Thanks for your advice! I finally figure out how to set the material culling by code and made ui element to be seen from the back.but it still can not be clicked :joy: ,the example project is here:
https://playcanvas.com/editor/scene/835641

1 Like

Can’t agree more :smile:

It seems that the translation of the bounding box is still wrong so clicks doesn’t match the rendered element.

I don’t see any other way fixing this right now, but the nasty way: overlay a non culled/rotated element on top with opacity set to 0. Use that to catch the input.

1 Like