decentraland / godot-explorer

10 stars 10 forks source link

Spike: UI Test comparing with Foundation Client #366

Open kuruk-mm opened 6 months ago

kuruk-mm commented 6 months ago

Create a scene with UI and report the differences between the Foundation, Godot and Bevy.

How?

Start simple, and go to the UI features, comparing with the Foundation Client

When a difference is detected, take a picture of the clients (video if needed), post that a comment here the code that you used and the picture, and make a commit in the scene repo

Suggestion: To go thought the UI Features, use the docs as reference https://docs.decentraland.org/creator/development-guide/sdk7/onscreen-ui/

sdilauro commented 6 months ago

Input

Input behavior is weird, you can test in the branch bugs/ui-input:

Bonus

Foundation:

https://github.com/dclexplorer/ui-test-scene/assets/22157752/e7efcb16-6f4f-469c-af4f-5e1c2563bf05

Godot:

https://github.com/dclexplorer/ui-test-scene/assets/22157752/a88dbd3a-9951-45bf-afeb-57167a2ad022

sdilauro commented 6 months ago

Text

Foundation:

ui-text-padding-f

Godot:

ui-text-padding-g

sdilauro commented 6 months ago

Button

You can test the scene in the branch ui-button

Godot: button-1-g

Foundation: button-1-f

sdilauro commented 6 months ago

UI Transform: minHeight

The menu and button's parent has a minHeight applied. It works in Foundation but the element grows up to the window's limit in Godot.

You can test it in the branch ui-transform-min-height

Godot:

https://github.com/decentraland/godot-explorer/assets/22157752/c65e92c6-1ffa-4b64-b9dc-1b536913ef3d

Foundation:

https://github.com/decentraland/godot-explorer/assets/22157752/239e2cd1-35db-433e-a0bb-3385af3296af

sdilauro commented 6 months ago

Spinner

The left is a rotating sprite and the right is an animated sprite (8 frames).

Godot:

https://github.com/decentraland/godot-explorer/assets/22157752/d08d2ded-5ce9-4512-8352-1ebf665c5cf9

Foundation:

https://github.com/decentraland/godot-explorer/assets/22157752/a679e78b-a82d-4bdd-93e8-9a942be0d096

sdilauro commented 6 months ago

JustifyContent: 'space-evenly'

This property works fine in Godot but doesn't in Foundation: image

sdilauro commented 6 months ago

Change the color on ui-background property

I was making other elements clickable, which works fine, but the Godot's button size appears broken. That doesn't be related to clickable elements but is a wrong behavior.

check this repo

https://github.com/decentraland/godot-explorer/assets/22157752/872b9b16-99e2-4e70-b8e9-70fc0d2d76c6

sdilauro commented 6 months ago

UITransform: alignItems: 'baseline'

see this repo

image

sdilauro commented 6 months ago

Overflow: scroll

Try this code:


const uiComponent = () => (
  <UiEntity
    uiTransform={{
      maxWidth: 225,
      height: '100%',
      overflow: 'scroll',
      flexShrink: 20,
      pointerFilter: 'block'
    }}
    >
      <UiEntity
        uiTransform={{
          minWidth: 150,
          minHeight: 150,

        }}
        uiBackground={{ color: Color4.Green() }}
      />
      <UiEntity
        uiTransform={{
          minWidth: 150,
          minHeight: 150,
        }}
        uiBackground={{ color: Color4.Red() }}
      />
      <UiEntity
        uiTransform={{
          minWidth: 150,
          minHeight: 150,
        }}
        uiBackground={{ color: Color4.Blue() }}
      />
  </UiEntity>
)

export function setupUi() {
  ReactEcsRenderer.setUiRenderer(uiComponent)
}

and obtain this: image

It's the same behavior in both clients, but this should hide the overflow content and make scrollable parent.

sdilauro commented 6 months ago

flexWrap

When flex-wrap is set as wrap and align-content is in center the clients behave differently.

try this code:


const uiComponent = () => (
  <UiEntity
    uiTransform={{
      alignContent:'center',
      width: 450,
      height: '100%',
      flexWrap: 'wrap'
    }}
    >
      <UiEntity
        uiTransform={{
          width: 150,
          height: 150,
        }}
        uiBackground={{ color: Color4.Green() }}
      />
      <UiEntity
        uiTransform={{
          width: 150,
          height: 150,
        }}
        uiBackground={{ color: Color4.Red() }}
      />
      <UiEntity
        uiTransform={{
          width: 150,
          height: 150,
        }}
        uiBackground={{ color: Color4.Blue() }}
      />
  </UiEntity>
)

export function setupUi() {
  ReactEcsRenderer.setUiRenderer(uiComponent)
}

image

sdilauro commented 6 months ago

Dropdown

This component looks different but works fine (test in this repo)

Godot: image

Foundation: image

Both closed: image