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

Update UIContainerLayouts.kt so graphics{} work better #2166

Merged
merged 4 commits into from
Mar 26, 2024
Merged

Conversation

rafi0
Copy link
Contributor

@rafi0 rafi0 commented Feb 26, 2024

Fixes #2164

@soywiz
Copy link
Member

soywiz commented Feb 26, 2024

Thanks! We will need to do the same for the rest, including UIHorizontalStack, etc.
Also we will need to add a test that verifies Y positions flor these views. And maybe a reference tests. Instead of texts, with solid rects that are less likely to fail due slight vector inconsistencies.

@soywiz
Copy link
Member

soywiz commented Mar 1, 2024

Fixes #2164

Copy link
Member

@soywiz soywiz left a comment

Choose a reason for hiding this comment

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

We need two things:

  • Update UIHorizontalStack too.
  • Add a test that checks the new behaviour.

My suggestion for the test is the following:

@Test
fun testUIVerticalStack() {
  val stack = UIVerticalStack()
  val view1 = stack.solidRect(10, 10, Colors.RED)
  val view2 = stack.graphics { fill(Colors.RED) { rect(10, 10, 20, 20) } }
  val view3 = stack.solidRect(10, 10, Colors.RED)
  stack.relayout()
  assertEquals("...", "${view1.y.niceStr},${view2.y.niceStr},${view3.y.niceStr}")
}

By applying/reverting this change the view3.y should be different. So that will cover that we have fixed the issue.

@rafi0 rafi0 requested a review from soywiz March 25, 2024 17:46
Copy link
Member

@soywiz soywiz left a comment

Choose a reason for hiding this comment

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

LGTM

@soywiz soywiz merged commit 387fa55 into korlibs:main Mar 26, 2024
9 checks passed
@soywiz
Copy link
Member

soywiz commented Mar 26, 2024

Thank you very much!

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.

graphics{} on uiVerticalStack is not checking bounds
2 participants