decentraland / sdk

PM repository for SDK
Apache License 2.0
4 stars 4 forks source link

SDK7: Unless the outer UiEntity / parent of a temporary 2D UI is full screen, then it doesn’t appear on the screen #940

Open cfravel opened 1 year ago

cfravel commented 1 year ago

Background provided in a comment

Steps to reproduce:

  1. Clone the demo scene at Cloning the scene in https://gitlab.com/dcl-tech/demo-uis
  2. Be sure that the useGeneralizedCompositing variable near the top of DemoUs.tsx is set to true
  3. Run it in preview
  4. If you don’t see the 2D Uis appear automatically, click on the green box to open them
  5. . // You may have to click a second time, see issue #937
  6. Click the button on Ui_3 to maximize Ui_3 and see a second button.
  7. Click that second button
  8. // Expected: an announcement to be displayed
  9. // Actual: nothing appears, although the browser Console shows that the number of UIs increases by 1 for a few seconds, and then goes back down one.

Note that the difference between the effect of the 2nd button on Ui_3, compared to Ui_2 is that in the case of Ui_3, the invisible “wrapper/outer” entity for the Announcement UI is sized at zero width and height, whereas in Ui_2 case it is full screen and, at least in Preview, therefore blocks the mouse from 3D interactions. Fullscreen and hence blocking is controlled by an optional second boolean parameter to displayAnnouncement(), which differs between the calls from Ui_2 (blocking) and Ui_3 (non-blocking).

Note that mouse blocking of 3D interactions during the temporary might occur only in Preview.

cfravel commented 1 year ago

One might use a full-screen invisible outer Entity to block mouse clicking into the 3d screen, but othewise there should be no harm in having a parent/outer UiEntity be at 0,0, and size 0,0, if its children are positioned absolutely,

One would think that if you have a zero-sized outer UiEntity, and its children have absolute positioning, that they would show up, and they do in this example scene for Uis 1, 2, and/or 3.

But for the Announcement UI, it does not appear if the outer UiEntity is pos 0,0 size 0,0

The announcement from the secondary button on Ui_2 has a fullscreen outer parent, and it appears. The announcement from the secondary button on Ui_3 has a 0 sized outer parent, and it doesn't appear, although the other UIs, which share that 0-sized outer parent, DO appear.