feat: render source paint overrides with read-only object dependencies
Verify Tessera GUI / verify (push) Failing after 7m37s
Verify Tessera GUI / verify (push) Failing after 7m37s
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
| File | Purpose |
|
||||
| --- | --- |
|
||||
| [source-paint.endor](source-paint.endor) | Source paint overrides render checked commands in the window; a source Button method updates the shared tint model. |
|
||||
| [visual-protocols.endor](visual-protocols.endor) | Real source calls for constrained native measurement, arrangement and managed paint-command results from live Mounts. |
|
||||
| [mount-lifecycle.endor](mount-lifecycle.endor) | Source onMount/onUnmount methods, two occurrences of one object, ordered notifications and retained Mount lifetime. |
|
||||
| [events.endor](events.endor) | Managed event subscriptions, source onEvent override and numbered capture/target/bubble steps from native input. |
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
class TintRect: RectBlock {
|
||||
tint: String
|
||||
function paint(self: TintRect, mount: Mount, geometry: Bounds): DisplayList {
|
||||
drawing = RectBlock.paint(self, mount, geometry)
|
||||
drawing.commands.at(0).color = self.tint
|
||||
return drawing
|
||||
}
|
||||
}
|
||||
class Badge: TextBlock {
|
||||
background: String
|
||||
function paint(self: Badge, mount: Mount, geometry: Bounds): DisplayList {
|
||||
fill = PaintCommand()
|
||||
fill.kind = "roundedRect"
|
||||
fill.x = geometry.x
|
||||
fill.y = geometry.y
|
||||
fill.width = geometry.width
|
||||
fill.height = geometry.height
|
||||
fill.radius = 6
|
||||
fill.color = self.background
|
||||
text = TextBlock.paint(self, mount, geometry).commands.at(0)
|
||||
text.color = "#FFFFFF"
|
||||
return DisplayList(ObjectList(fill, text))
|
||||
}
|
||||
}
|
||||
class RecolorButton: Button {
|
||||
target: TintRect
|
||||
function onEvent(self: RecolorButton, event: Event): Unit {
|
||||
self.target.tint = "#526AC7"
|
||||
}
|
||||
}
|
||||
rect = TintRect(200, 60, 12, "#DDEEFF", "#ED6A5A")
|
||||
badge = Badge("Endor 源码正在绘制这个背景", 2, "#237A45")
|
||||
button = RecolorButton("通过对象方法改变绘制颜色", rect)
|
||||
root = Column(24, 16, TextBlock("源码 paint 进入真实窗口", 2), rect, rect, badge, button)
|
||||
page = Page()
|
||||
page.render(root)
|
||||
Reference in New Issue
Block a user