Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sdk7 ui text position #5884

Merged
merged 2 commits into from
Nov 1, 2023
Merged

fix: sdk7 ui text position #5884

merged 2 commits into from
Nov 1, 2023

Conversation

pravusjif
Copy link
Member

@pravusjif pravusjif commented Nov 1, 2023

  • Reverted initial position type for ui text
  • Added position type update based on root element (only affects ui text for now)

Copilot summary

🤖 Generated by Copilot at 2cf7646

Refactor the UI system to fix layout issues and simplify UI element creation. Change the default position of UI elements to absolute and add a condition for auto width or height in UIElementHandlerBase.cs. Move the SetElementDefaultStyle method from UiElementUtils.cs to UIElementHandlerBase.cs.


QA TEST INSTRUCTIONS

  1. Enter the the residence tower at https://play.decentraland.org/?realm=main&position=116%2C-26&explorer-branch=fix/sdk7-ui-text-position
  2. Enter the lobby and click on the "Elevator" button you'll see in the scene UI
  3. Confirm the "Bar" button text is centered in the new panel that opens
  4. If you test the same with https://play.decentraland.org/?realm=main&position=116%2C-26 (production build) you'll see it's not centered, so it's wrong in production.
Screen Shot 2023-11-01 at 15 32 50

@pravusjif pravusjif self-assigned this Nov 1, 2023
@pravusjif pravusjif marked this pull request as ready for review November 1, 2023 14:43
@pravusjif pravusjif requested a review from a team as a code owner November 1, 2023 14:43
@pravusjif pravusjif requested a review from popuz November 1, 2023 14:47
@@ -10,7 +10,7 @@ public static void SetElementDefaultStyle(IStyle elementStyle)
elementStyle.bottom = 0;
elementStyle.width = new StyleLength(StyleKeyword.Auto);
elementStyle.height = new StyleLength(StyleKeyword.Auto);
elementStyle.position = new StyleEnum<Position>(Position.Relative);
elementStyle.position = new StyleEnum<Position>(Position.Absolute);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm its weird.
We are sending the position: relative by default on the sdk level 🤔
https://github.com/decentraland/js-sdk-toolchain/blob/main/packages/%40dcl/react-ecs/src/components/uiTransform/index.ts#L37

Copy link
Member Author

@pravusjif pravusjif Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that change right now only affects the UiText, and it only affects the inner visual element of the UiText.
Some UiComponents we create are actually composed of 2 visual elements: a root element that acts as a kind of container and an inner one. UiText has a container and a label as the child, that absolute setting affects the Label.

We were already setting this as Absolute before I implemented the auto-size support.

@pravusjif pravusjif requested a review from LucasLioyQA November 1, 2023 14:57
Copy link
Contributor

@Ludmilafantaniella Ludmilafantaniella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Reviewed and approved
textcentered

@pravusjif pravusjif merged commit a0c314c into dev Nov 1, 2023
2 checks passed
@pravusjif pravusjif deleted the fix/sdk7-ui-text-position branch November 1, 2023 15:02
pravusjif added a commit that referenced this pull request Nov 1, 2023
* Reverted initial position type for ui text
* Added position type update based on root element (only affects ui text for now)
Copy link
Contributor

@LucasLioyQA LucasLioyQA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-11-01 at 11 52 45

QA approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants