feat: allocate weighted flex space and remeasure affected occurrences
Verify Tessera GUI / verify (push) Failing after 7m59s
Verify Tessera GUI / verify (push) Failing after 7m59s
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
class Actions {
|
||||
filler: RectBlock
|
||||
function balanced(self: Actions): Unit { self.filler.flex = 1 }
|
||||
function narrow(self: Actions): Unit { self.filler.flex = 3 }
|
||||
}
|
||||
paragraph = TextBlock("GUI 和代码操控同一套 Aster 内存对象系统。对象只有一份,但每次挂载都有自己的约束和布局。这里用同一个 TextBlock 在两个容器中显示不同的换行。修改权重会重新测量文字高度,随后更新相邻布局。GUI 和代码操控同一套 Aster 内存对象系统。对象只有一份,但每次挂载都有自己的约束和布局。这里用同一个 TextBlock 在两个容器中显示不同的换行。修改权重会重新测量文字高度,随后更新相邻布局。")
|
||||
paragraph.flex = 1
|
||||
filler = RectBlock(20, 20)
|
||||
filler.flex = 1
|
||||
actions = Actions(filler)
|
||||
balanced = Button("等比例分配")
|
||||
balanced.onClick(actions.balanced)
|
||||
narrow = Button("文字只占四分之一")
|
||||
narrow.onClick(actions.narrow)
|
||||
first = Row(10, 10, paragraph, filler)
|
||||
second = Row(10, 10, paragraph, RectBlock(300, 20))
|
||||
page = Page()
|
||||
page.title = "按权重分配与文字重排"
|
||||
page.render(Column(10, 10, Row(0, 10, balanced, narrow), first, second))
|
||||
Reference in New Issue
Block a user