feat: constrain flex bases and redistribute bounded growth and shrink
Verify Tessera GUI / verify (push) Failing after 9m4s
Verify Tessera GUI / verify (push) Failing after 9m4s
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
class Strip: Row {
|
||||
function measure(self: Strip, mount: Mount, constraints: Constraints): MeasureResult {
|
||||
return MeasureResult(340, 60)
|
||||
}
|
||||
}
|
||||
class Actions {
|
||||
first: RectBlock
|
||||
second: RectBlock
|
||||
function grow(self: Actions): Unit {
|
||||
self.first.flexMin = 0
|
||||
self.first.flexMax = 105
|
||||
self.first.flexBasis = 100
|
||||
self.second.flexBasis = 100
|
||||
self.first.flex = 1
|
||||
self.second.flex = 3
|
||||
}
|
||||
function shrink(self: Actions): Unit {
|
||||
self.first.flexMax = 300
|
||||
self.first.flexMin = 150
|
||||
self.first.flexBasis = 200
|
||||
self.second.flexBasis = 200
|
||||
self.first.flex = 0
|
||||
self.second.flex = 0
|
||||
self.first.flexShrink = 1
|
||||
self.second.flexShrink = 1
|
||||
}
|
||||
}
|
||||
first = RectBlock(20, 20, 4, "#A4C8F0")
|
||||
second = RectBlock(40, 20, 4, "#A6D8B2")
|
||||
fixed = RectBlock(60, 20, 4, "#E8C990")
|
||||
actions = Actions(first, second)
|
||||
grow = Button("增长:上限后重新分配")
|
||||
grow.onClick(actions.grow)
|
||||
shrink = Button("收缩:最小尺寸后重新分配")
|
||||
shrink.onClick(actions.shrink)
|
||||
actions.grow()
|
||||
strip = Strip(10, 10, first, second, fixed)
|
||||
page = Page()
|
||||
page.title = "基础尺寸与边界"
|
||||
page.render(Column(20, 12, Row(0, 10, grow, shrink), strip, TextBlock("增长:105 / 135 / 60;收缩:150 / 90 / 60。")))
|
||||
Reference in New Issue
Block a user