docs: clarify layout example dependency and occurrence contracts

This commit is contained in:
2026-11-12 21:23:58 +08:00
parent 94e0f96e4a
commit 8a6bdc3790
8 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ class Actions {
function both(self: Actions): Unit { self.vertical.axis = "both" }
}
paragraph = TextBlock("这里展示的是同一个 TextBlock。左侧只允许纵向滚动,文字会按照这个 Mount 的实际视口宽度换行;右侧只允许横向滚动,文字保留横向展开。对象的文字和业务状态只有一份,每次展示的约束、几何和滚动位置分别保存。修改滚动轴也会重新测量受影响内容,并将已经不再允许的偏移夹回零。布局传播持续到受影响部分稳定,不会按固定跳数丢弃后续更新。这里展示的是同一个 TextBlock,两个视图可以拥有不同的换行结果。")
// 纵向区域padding后内容宽为244,长文字按此有限宽换行。
// 构造视口宽 260,左右 padding 各 8 时内容宽为 244;若父分配另行缩窄,则应按该 Mount 实际视口重算。
vertical = ScrollBlock(260, 140, paragraph)
vertical.padding = 8
// 先给左对象设置 vertical,右对象随后独立设 horizontal;同一 paragraph 不保存任何一个父容器的轴策略。