feat: expose native visual protocols and explicit invalidation
Verify Tessera GUI / verify (push) Failing after 7m23s
Verify Tessera GUI / verify (push) Failing after 7m23s
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
class VisualResults {
|
||||
width: Number
|
||||
height: Number
|
||||
childX: Number
|
||||
childY: Number
|
||||
color: String
|
||||
}
|
||||
class ProbeRect: RectBlock {
|
||||
results: VisualResults
|
||||
function onMount(self: ProbeRect, mount: Mount): Unit {
|
||||
measured = self.measure(mount, Constraints(0, 0, 120, 80))
|
||||
self.results.width = measured.width
|
||||
self.results.height = measured.height
|
||||
drawing = self.paint(mount, Bounds(12, 18, 200, 60))
|
||||
self.results.color = drawing.commands.at(0).color
|
||||
}
|
||||
}
|
||||
class ProbeColumn: Column {
|
||||
results: VisualResults
|
||||
function onMount(self: ProbeColumn, mount: Mount): Unit {
|
||||
positions = self.arrange(mount, Bounds(20, 30, 500, 300))
|
||||
self.results.childX = positions.children.at(0).x
|
||||
self.results.childY = positions.children.at(0).y
|
||||
}
|
||||
}
|
||||
results = VisualResults(0, 0, 0, 0, "等待挂载")
|
||||
rect = ProbeRect(200, 60, 12, "#DDEEFF", results)
|
||||
root = ProbeColumn(24, 16, TextBlock("对象的原生视觉协议", 2), rect, TextBlock("约束测量宽度"), ui.textOf(results, "width"), TextBlock("绘制颜色"), ui.textOf(results, "color"), results)
|
||||
page = Page()
|
||||
page.render(root)
|
||||
Reference in New Issue
Block a user