diff --git a/examples/events.endor b/examples/events.endor index 87022d3..254e5b5 100644 --- a/examples/events.endor +++ b/examples/events.endor @@ -1,5 +1,6 @@ // 同一托管对象系统中的事件阶段:祖先 capture → 目标 onEvent → 目标监听器 → 祖先 bubble。 // EventLog 用一个递增序列记录实际次序;改变监听器/传播标记可对比跳过与停止的语义。 +// 首行仅列本例的非空阶段;额外的目标 capture、旧式 onClick 及其他祖先处理仍由通用分发器决定。 // 保存各阶段序号与最近 phase;count 是共享状态,其他字段直接写在本模型中。 class EventLog { // count 保存跨阶段递增的总序列;四个 Step 保存各阶段最近一次序号,不是各自独立递增的计数器。 @@ -38,6 +39,7 @@ class EventButton: Button { // 把模型序列递增后写 methodStep,供断言与 capture/target/bubble 比较。 function onEvent(self: EventButton, event: Event): Unit { // 分发器查找对象方法后进入这里,无需再给此方法单独注册 on 连接;方法返回后继续目标监听器。 + // 本覆盖不检查 event.kind;显式 on 连接只监听 click,而该对象方法也可能处理源码派发的其他事件。 self.model.count.increment() self.model.methodStep = self.model.count.value self.model.phase = event.phase diff --git a/examples/mount-lifecycle.endor b/examples/mount-lifecycle.endor index 60bb8d1..cc3e183 100644 --- a/examples/mount-lifecycle.endor +++ b/examples/mount-lifecycle.endor @@ -22,6 +22,7 @@ class WatchedText: TextBlock { self.log.mounted.increment() self.log.childMounted = self.log.order.value // 保存最近一次参数供 Console 查询,后一次通知会覆盖前一次;mounted 累计值则保留两次调用。 + // latest.value 强持有这个 Mount 供观察,不使已卸载 Mount 复活;Mount 到 Page/desktop 的反向关系仍为弱引用。 self.log.latest.set(mount) self.setText("同一个对象,两个独立挂载位置") } diff --git a/examples/scene-viewports.endor b/examples/scene-viewports.endor index 85d2dbd..535f689 100644 --- a/examples/scene-viewports.endor +++ b/examples/scene-viewports.endor @@ -20,6 +20,7 @@ inner = CanvasViewport(200, 100, Scene2D(RectBlock(120, 60, 8, "#D4E6D9"))) inner.x = 260 inner.y = 40 // 两个外层视口引用同一 world,卡片/内层视口因此各产生两个出现位置。 +// inner 自身仍是同一个 CanvasViewport 对象,其 camera 属性也只有一份;两个 inner Mount 的导航会联动,约束/裁剪仍各自独立。 world = Scene2D(card, inner) // 左右视口尺寸和相机平移/缩放不同;显式赋同一 camera 才会共享导航状态。 left = CanvasViewport(460, 320, world) diff --git a/examples/scene3d.endor b/examples/scene3d.endor index dc7d1d7..1fac240 100644 --- a/examples/scene3d.endor +++ b/examples/scene3d.endor @@ -1,5 +1,5 @@ // 同一 Scene3D 在透视/正交视口中展示;相机控制独立,网格业务变换由两边共享。 -// 三维内容与普通 Endor 二维控件一起排版,viewport 有限尺寸不限制场景世界坐标。 +// 三维内容与普通 Endor 二维控件一起排版;viewport 的像素宽高不是场景世界坐标范围,世界数值与几何规模仍受宿主预算检查。 // 保存左侧视口和共享立方体;动作可改相机位置或真实网格变换。 class SceneActions { // view 只保存左透视视口,cube 保存两个视口共同引用的网格,两个字段的修改传播范围不同。 diff --git a/examples/tab-placement.endor b/examples/tab-placement.endor index 88c9db1..c4c822c 100644 --- a/examples/tab-placement.endor +++ b/examples/tab-placement.endor @@ -7,6 +7,7 @@ class TrackedPage: Page { // 先递增 calls,再显式调用基类执行跨窗迁移;Page 身份保留,旧 Mount 上下文会替换。 function moveToWindow(self: TrackedPage, window: Window): Page { // 外部代码/API 选择此源覆盖时进入;显式 Page.moveToWindow 绕过再次动态分派,避免递归调用自身。 + // 计数先于原生迁移执行;如果随后基类报错,已发生的 increment 不自动回滚,不能把它当作成功迁移次数。 self.calls.increment() return Page.moveToWindow(self, window) } diff --git a/examples/world-ui.endor b/examples/world-ui.endor index 97bc07e..dd75d67 100644 --- a/examples/world-ui.endor +++ b/examples/world-ui.endor @@ -8,6 +8,7 @@ class WorldActions { panel: Panel3D canvas: CanvasViewport // 重置三维相机位置与观察目标,不改变面板或内层画布业务状态。 + // 不重建 Camera,也不复位其 fov/near/far/up 或 controller;reset 仅写下面显式列出的六个属性。 function reset(self: WorldActions): Unit { // reset.onClick 派发零参绑定方法,按绝对值恢复外层相机位置/target;不会调用 canvas.fitView。 self.view.camera.x = 0