@typecad/ui 1.0.0-alpha.12 → 1.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/fonts/dejavu/DejaVuSans-Bold.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSans-ExtraLight.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSans-Oblique.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSans.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSansMono-Bold.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSansMono.ttf +0 -0
- package/assets/fonts/dejavu/LICENSE +187 -0
- package/assets/fonts/dejavu/README.md +49 -0
- package/dist/engine-index.js +2 -0
- package/dist/preview/build-program.d.ts +7 -1
- package/dist/preview/build-program.js +94 -15
- package/dist/preview/host-gfx.d.ts +3 -0
- package/dist/preview/host-gfx.js +30 -3
- package/dist/preview/host-ui-runtime.d.ts +115 -0
- package/dist/preview/host-ui-runtime.js +928 -46
- package/dist/ui-engine/block-layout.js +25 -11
- package/dist/ui-engine/color.d.ts +6 -0
- package/dist/ui-engine/color.js +80 -2
- package/dist/ui-engine/compat-report.d.ts +8 -0
- package/dist/ui-engine/compat-report.js +124 -0
- package/dist/ui-engine/css-imports.d.ts +4 -0
- package/dist/ui-engine/css-imports.js +70 -0
- package/dist/ui-engine/css-parser.js +58 -14
- package/dist/ui-engine/default-font.d.ts +25 -0
- package/dist/ui-engine/default-font.js +80 -0
- package/dist/ui-engine/font-assets.d.ts +2 -2
- package/dist/ui-engine/font-assets.js +22 -5
- package/dist/ui-engine/html-parser.d.ts +4 -0
- package/dist/ui-engine/html-parser.js +241 -26
- package/dist/ui-engine/image-assets.d.ts +8 -1
- package/dist/ui-engine/image-assets.js +35 -2
- package/dist/ui-engine/image-decode.d.ts +22 -0
- package/dist/ui-engine/image-decode.js +194 -0
- package/dist/ui-engine/inline-parser.js +1 -1
- package/dist/ui-engine/layout-engine.d.ts +19 -0
- package/dist/ui-engine/layout-engine.js +59 -3
- package/dist/ui-engine/model.d.ts +18 -0
- package/dist/ui-engine/model.js +75 -7
- package/dist/ui-engine/runtime-header/blend-bodies.js +29 -9
- package/dist/ui-engine/runtime-header/canvas-helpers.js +3 -0
- package/dist/ui-engine/runtime-header/canvas-scrollbar.js +115 -111
- package/dist/ui-engine/runtime-header/cuttlefish-gfx.js +21 -0
- package/dist/ui-engine/runtime-header/dirty-scroll-mutators.js +182 -179
- package/dist/ui-engine/runtime-header/forward-decls.js +215 -167
- package/dist/ui-engine/runtime-header/init-press-input.js +138 -135
- package/dist/ui-engine/runtime-header/keyboard.js +682 -380
- package/dist/ui-engine/runtime-header/node-draw-body.js +1656 -1386
- package/dist/ui-engine/runtime-header/paint-order-coords.js +259 -214
- package/dist/ui-engine/runtime-header/paint-rects-repair.js +736 -568
- package/dist/ui-engine/runtime-header/scroll-physics.js +25 -1
- package/dist/ui-engine/runtime-header/state-bindings-nav.js +9 -0
- package/dist/ui-engine/runtime-header/structs.js +228 -216
- package/dist/ui-engine/runtime-header/text-rendering.js +888 -770
- package/dist/ui-engine/runtime-header/tick/bindings-phase.js +118 -116
- package/dist/ui-engine/runtime-header/tick/dirty-draw-phase.js +897 -633
- package/dist/ui-engine/runtime-header/tick/scroll-canvas-phase.js +24 -25
- package/dist/ui-engine/runtime-header/touch-keyboard-fwd.js +78 -23
- package/dist/ui-engine/runtime-header/types-defines.js +110 -93
- package/dist/ui-engine/shadcn-kit.d.ts +1 -0
- package/dist/ui-engine/shadcn-kit.js +502 -0
- package/dist/ui-engine/style-resolver.d.ts +4 -0
- package/dist/ui-engine/style-resolver.js +58 -6
- package/dist/ui-engine/transpile-ui.js +12 -5
- package/dist/ui-engine/ua-stylesheet.d.ts +22 -1
- package/dist/ui-engine/ua-stylesheet.js +119 -32
- package/dist/ui-engine/ui-lowering.js +37 -3
- package/dist/ui-engine/ui-registry.js +32 -4
- package/dist/ui-engine/yoga-layout.js +57 -52
- package/package.json +9 -3
- package/src/engine-index.ts +53 -51
- package/src/preview/build-program.ts +810 -734
- package/src/preview/host-gfx.ts +30 -3
- package/src/preview/host-ui-runtime.ts +4133 -3289
- package/src/ui-engine/block-layout.ts +24 -11
- package/src/ui-engine/color.ts +77 -2
- package/src/ui-engine/compat-report.ts +139 -0
- package/src/ui-engine/css-imports.ts +69 -0
- package/src/ui-engine/css-parser.ts +64 -15
- package/src/ui-engine/default-font.ts +95 -0
- package/src/ui-engine/font-assets.ts +545 -525
- package/src/ui-engine/html-parser.ts +615 -397
- package/src/ui-engine/image-assets.ts +37 -2
- package/src/ui-engine/image-decode.ts +244 -0
- package/src/ui-engine/inline-parser.ts +1 -1
- package/src/ui-engine/layout-engine.ts +61 -3
- package/src/ui-engine/model.ts +1317 -1230
- package/src/ui-engine/runtime-header/blend-bodies.ts +29 -9
- package/src/ui-engine/runtime-header/canvas-helpers.ts +3 -0
- package/src/ui-engine/runtime-header/canvas-scrollbar.ts +121 -117
- package/src/ui-engine/runtime-header/cuttlefish-gfx.ts +21 -0
- package/src/ui-engine/runtime-header/dirty-scroll-mutators.ts +188 -185
- package/src/ui-engine/runtime-header/forward-decls.ts +227 -179
- package/src/ui-engine/runtime-header/init-press-input.ts +144 -141
- package/src/ui-engine/runtime-header/keyboard.ts +689 -386
- package/src/ui-engine/runtime-header/node-draw-body.ts +1681 -1411
- package/src/ui-engine/runtime-header/paint-order-coords.ts +265 -220
- package/src/ui-engine/runtime-header/paint-rects-repair.ts +742 -574
- package/src/ui-engine/runtime-header/scroll-physics.ts +25 -1
- package/src/ui-engine/runtime-header/state-bindings-nav.ts +9 -0
- package/src/ui-engine/runtime-header/structs.ts +234 -222
- package/src/ui-engine/runtime-header/text-rendering.ts +894 -776
- package/src/ui-engine/runtime-header/tick/bindings-phase.ts +124 -122
- package/src/ui-engine/runtime-header/tick/dirty-draw-phase.ts +902 -638
- package/src/ui-engine/runtime-header/tick/scroll-canvas-phase.ts +30 -31
- package/src/ui-engine/runtime-header/touch-keyboard-fwd.ts +78 -23
- package/src/ui-engine/runtime-header/types-defines.ts +116 -99
- package/src/ui-engine/shadcn-kit.ts +503 -0
- package/src/ui-engine/style-resolver.ts +471 -416
- package/src/ui-engine/transpile-ui.ts +12 -5
- package/src/ui-engine/ua-stylesheet.ts +137 -31
- package/src/ui-engine/ui-lowering.ts +486 -452
- package/src/ui-engine/ui-registry.ts +556 -524
- package/src/ui-engine/yoga-layout.ts +307 -309
|
@@ -1,185 +1,188 @@
|
|
|
1
|
-
// Slice of the C++ runtime header (original source lines 1548-1710).
|
|
2
|
-
// mark_dirty, subtree dirty, scroll direct prepare/compositor, scroll view dirty/overlap/invalidate.
|
|
3
|
-
// See docs/superpowers/specs/2026-07-12-split-runtime-header-design.md.
|
|
4
|
-
export function emitDirtyScrollMutators(): string {
|
|
5
|
-
return `
|
|
6
|
-
static inline void ui_mark_dirty(uint16_t nodeIdx) {
|
|
7
|
-
if (nodeIdx >= __ui_node_count) return;
|
|
8
|
-
__ui_nodes[nodeIdx].dirty = 1;
|
|
9
|
-
if (ui_is_effectively_visible(nodeIdx) &&
|
|
10
|
-
__ui_nodes[nodeIdx].screenId == __ui_active_screen) {
|
|
11
|
-
UIRect r;
|
|
12
|
-
ui_node_current_paint_rect(nodeIdx, &r);
|
|
13
|
-
if (r.w <= 0 || r.h <= 0) {
|
|
14
|
-
ui_mark_overlapping_higher_layers_dirty(nodeIdx);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
uint16_t p = __ui_nodes[nodeIdx].parent;
|
|
18
|
-
while (p != UI_NO_PARENT && p < __ui_node_count) {
|
|
19
|
-
if (__ui_nodes[p].scrollable &&
|
|
20
|
-
!__ui_nodes[p].virtualized &&
|
|
21
|
-
__ui_nodes[p].contentHeight > __ui_nodes[p].box.h) {
|
|
22
|
-
UIRect clip = {
|
|
23
|
-
__ui_nodes[p].box.x,
|
|
24
|
-
__ui_nodes[p].box.y,
|
|
25
|
-
__ui_nodes[p].box.w,
|
|
26
|
-
__ui_nodes[p].box.h
|
|
27
|
-
};
|
|
28
|
-
if (!ui_rects_intersect(r.x, r.y, r.w, r.h, clip.x, clip.y, clip.w, clip.h)) {
|
|
29
|
-
__ui_nodes[nodeIdx].dirty = 0;
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (r.x < clip.x ||
|
|
33
|
-
r.x + r.w > clip.x + clip.w ||
|
|
34
|
-
r.y < clip.y ||
|
|
35
|
-
r.y + r.h > clip.y + clip.h) {
|
|
36
|
-
ui_mark_scroll_view_dirty(p);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
// Fully inside the viewport
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
__ui_nodes[scrollNode].
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
int16_t
|
|
76
|
-
|
|
77
|
-
int16_t
|
|
78
|
-
int16_t
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
__ui_nodes[c].
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
if (__ui_nodes[
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
1
|
+
// Slice of the C++ runtime header (original source lines 1548-1710).
|
|
2
|
+
// mark_dirty, subtree dirty, scroll direct prepare/compositor, scroll view dirty/overlap/invalidate.
|
|
3
|
+
// See docs/superpowers/specs/2026-07-12-split-runtime-header-design.md.
|
|
4
|
+
export function emitDirtyScrollMutators(): string {
|
|
5
|
+
return `
|
|
6
|
+
static inline void ui_mark_dirty(uint16_t nodeIdx) {
|
|
7
|
+
if (nodeIdx >= __ui_node_count) return;
|
|
8
|
+
__ui_nodes[nodeIdx].dirty = 1;
|
|
9
|
+
if (ui_is_effectively_visible(nodeIdx) &&
|
|
10
|
+
__ui_nodes[nodeIdx].screenId == __ui_active_screen) {
|
|
11
|
+
UIRect r;
|
|
12
|
+
ui_node_current_paint_rect(nodeIdx, &r);
|
|
13
|
+
if (r.w <= 0 || r.h <= 0) {
|
|
14
|
+
ui_mark_overlapping_higher_layers_dirty(nodeIdx);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
uint16_t p = __ui_nodes[nodeIdx].parent;
|
|
18
|
+
while (p != UI_NO_PARENT && p < __ui_node_count) {
|
|
19
|
+
if (__ui_nodes[p].scrollable &&
|
|
20
|
+
!__ui_nodes[p].virtualized &&
|
|
21
|
+
__ui_nodes[p].contentHeight > __ui_nodes[p].box.h) {
|
|
22
|
+
UIRect clip = {
|
|
23
|
+
__ui_nodes[p].box.x,
|
|
24
|
+
__ui_nodes[p].box.y,
|
|
25
|
+
__ui_nodes[p].box.w,
|
|
26
|
+
__ui_nodes[p].box.h
|
|
27
|
+
};
|
|
28
|
+
if (!ui_rects_intersect(r.x, r.y, r.w, r.h, clip.x, clip.y, clip.w, clip.h)) {
|
|
29
|
+
__ui_nodes[nodeIdx].dirty = 0;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (r.x < clip.x ||
|
|
33
|
+
r.x + r.w > clip.x + clip.w ||
|
|
34
|
+
r.y < clip.y ||
|
|
35
|
+
r.y + r.h > clip.y + clip.h) {
|
|
36
|
+
ui_mark_scroll_view_dirty(p);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// Fully inside the viewport: leave the CHILD dirty. The dirty loop's
|
|
40
|
+
// scroll defer lets fully-contained children repaint through their own
|
|
41
|
+
// buffered paint (one atomic push; the retained scroll canvas is
|
|
42
|
+
// invalidated after the draw). Promoting here recomposed the whole
|
|
43
|
+
// viewport per dirty tick — fine for a rare :pressed button, but with
|
|
44
|
+
// keyframe animations marking children (and their overlapping higher
|
|
45
|
+
// layers) at frame rate it turned every animation frame into a
|
|
46
|
+
// full-viewport canvas push — constant tearing on no-TE SPI panels.
|
|
47
|
+
}
|
|
48
|
+
p = __ui_nodes[p].parent;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
ui_mark_overlapping_higher_layers_dirty(nodeIdx);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Set dirty=1 across a scroll subtree WITHOUT the per-child O(n) overlap repair.
|
|
55
|
+
// During scroll the subtree repaints into a freshly-cleared off-screen canvas, so
|
|
56
|
+
// intra-subtree overlap repair is pointless, and scroll children are draw-clipped
|
|
57
|
+
// to the container's viewport box — so all external higher-z neighbors of the
|
|
58
|
+
// viewport are covered by ONE overlap check at the container's paint rect (done by
|
|
59
|
+
// the caller). This drops scroll marking from O(K·n) to O(K + n).
|
|
60
|
+
static inline void ui_mark_subtree_dirty_local(uint16_t scrollNode) {
|
|
61
|
+
if (scrollNode >= __ui_node_count) return;
|
|
62
|
+
for (uint16_t c = scrollNode + 1; c < __ui_nodes[scrollNode].subtreeEnd; c++) {
|
|
63
|
+
__ui_nodes[c].dirty = 1;
|
|
64
|
+
}
|
|
65
|
+
__ui_nodes[scrollNode].dirty = 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Mode C strip-only: direct-partial scroll when no viewport canvas fits and the
|
|
69
|
+
// scroll delta is small. Fills only the exposed strip on the display, then marks
|
|
70
|
+
// only the descendants that intersect that strip dirty for direct draw — mirroring
|
|
71
|
+
// the Mode B canvas repair path. Never clears the whole viewport, and never marks
|
|
72
|
+
// the whole subtree dirty (AGENTS.md: keep scroll drag invalidation small — a
|
|
73
|
+
// 1-pixel drag must not repaint every visible child).
|
|
74
|
+
static inline void ui_scroll_direct_prepare(uint16_t s, int16_t* outVX, int16_t* outVY) {
|
|
75
|
+
int16_t vw = __ui_nodes[s].box.w;
|
|
76
|
+
int16_t vh = __ui_nodes[s].box.h;
|
|
77
|
+
int16_t vox = __ui_nodes[s].box.x;
|
|
78
|
+
int16_t voy = __ui_nodes[s].box.y;
|
|
79
|
+
UI_COLOR_T scrollBg = __ui_nodes[s].hasBg ? __ui_nodes[s].bg : __ui_nodes[s].clearColor;
|
|
80
|
+
int16_t deltaY = __ui_nodes[s].scrollY - __ui_nodes[s].lastPaintedScrollY;
|
|
81
|
+
int16_t absDelta = deltaY < 0 ? -deltaY : deltaY;
|
|
82
|
+
int16_t stripY = deltaY > 0 ? static_cast<int16_t>(vh - absDelta) : 0;
|
|
83
|
+
ui_display_fill_rect(vox, static_cast<int16_t>(voy + stripY), vw, absDelta, scrollBg);
|
|
84
|
+
// Only descendants whose paint rect intersects the exposed strip need
|
|
85
|
+
// repainting; the rest keep their last-painted pixels (the strip background
|
|
86
|
+
// fill already covered the vacated band). Clear stale dirty flags on the
|
|
87
|
+
// others so a flag set by a prior frame (or a sibling promotion) doesn't
|
|
88
|
+
// trigger a needless repaint.
|
|
89
|
+
UIRect exposed = { vox, static_cast<int16_t>(voy + stripY), vw, absDelta };
|
|
90
|
+
for (uint16_t c = s + 1; c < __ui_nodes[s].subtreeEnd; c++) {
|
|
91
|
+
if (!ui_is_effectively_visible(c) || __ui_nodes[c].screenId != __ui_active_screen) {
|
|
92
|
+
__ui_nodes[c].dirty = 0;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
UIRect cr;
|
|
96
|
+
ui_node_current_paint_rect(c, &cr);
|
|
97
|
+
if (cr.w > 0 && cr.h > 0 &&
|
|
98
|
+
ui_rects_intersect(cr.x, cr.y, cr.w, cr.h, exposed.x, exposed.y, exposed.w, exposed.h)) {
|
|
99
|
+
__ui_nodes[c].dirty = 1;
|
|
100
|
+
if (__ui_nodes[c].kind == NODE_PROGRESS || __ui_nodes[c].kind == NODE_RANGE) {
|
|
101
|
+
__ui_nodes[c].lastTextWidth = -1;
|
|
102
|
+
}
|
|
103
|
+
__ui_nodes[c].lastTextHeight = 0;
|
|
104
|
+
} else {
|
|
105
|
+
__ui_nodes[c].dirty = 0;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
__ui_nodes[s].dirty = 0;
|
|
109
|
+
if (outVX) *outVX = vox;
|
|
110
|
+
if (outVY) *outVY = voy;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Nearest overflow scroll container owning nodeIdx (or nodeIdx itself).
|
|
114
|
+
static inline int16_t ui_overflow_scroll_compositor(uint16_t nodeIdx) {
|
|
115
|
+
if (nodeIdx >= __ui_node_count) return -1;
|
|
116
|
+
if (__ui_nodes[nodeIdx].scrollable && !__ui_nodes[nodeIdx].virtualized &&
|
|
117
|
+
__ui_nodes[nodeIdx].contentHeight > __ui_nodes[nodeIdx].box.h) {
|
|
118
|
+
return static_cast<int16_t>(nodeIdx);
|
|
119
|
+
}
|
|
120
|
+
uint16_t p = __ui_nodes[nodeIdx].parent;
|
|
121
|
+
while (p != UI_NO_PARENT && p < __ui_node_count) {
|
|
122
|
+
if (__ui_nodes[p].scrollable && !__ui_nodes[p].virtualized &&
|
|
123
|
+
__ui_nodes[p].contentHeight > __ui_nodes[p].box.h) {
|
|
124
|
+
return static_cast<int16_t>(p);
|
|
125
|
+
}
|
|
126
|
+
p = __ui_nodes[p].parent;
|
|
127
|
+
}
|
|
128
|
+
return -1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static inline void ui_mark_scroll_view_overlaps_dirty(uint16_t scrollNode) {
|
|
132
|
+
if (scrollNode >= __ui_node_count) return;
|
|
133
|
+
if (!ui_is_effectively_visible(scrollNode)) return;
|
|
134
|
+
if (__ui_nodes[scrollNode].screenId != __ui_active_screen) return;
|
|
135
|
+
UIRect r;
|
|
136
|
+
ui_node_current_paint_rect(scrollNode, &r);
|
|
137
|
+
if (r.w <= 0 || r.h <= 0) return;
|
|
138
|
+
for (uint16_t c = 0; c < __ui_node_count; c++) {
|
|
139
|
+
if (c == scrollNode) continue;
|
|
140
|
+
if (c > scrollNode && c < __ui_nodes[scrollNode].subtreeEnd) continue;
|
|
141
|
+
if (__ui_nodes[c].dirty) continue;
|
|
142
|
+
if (!ui_is_effectively_visible(c)) continue;
|
|
143
|
+
if (__ui_nodes[c].screenId != __ui_active_screen) continue;
|
|
144
|
+
if (!ui_node_draws_before(scrollNode, c)) continue;
|
|
145
|
+
UIRect cr;
|
|
146
|
+
ui_node_current_paint_rect(c, &cr);
|
|
147
|
+
if (cr.w <= 0 || cr.h <= 0) continue;
|
|
148
|
+
if (ui_rects_intersect(r.x, r.y, r.w, r.h, cr.x, cr.y, cr.w, cr.h)) {
|
|
149
|
+
__ui_nodes[c].dirty = 1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
static inline void ui_mark_scroll_subtree_dirty(uint16_t scrollNode) {
|
|
155
|
+
ui_mark_subtree_dirty_local(scrollNode);
|
|
156
|
+
// Single overlap check at the container's paint rect covers every external
|
|
157
|
+
// higher-z neighbor of the viewport. The container index is the right one to
|
|
158
|
+
// pass: scroll content lives within the container's stacking context, so
|
|
159
|
+
// ui_node_draws_before(scrollNode, c) selects exactly the external layers that
|
|
160
|
+
// should be repaired when the viewport is repainted.
|
|
161
|
+
ui_mark_overlapping_higher_layers_dirty(scrollNode);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
static inline void ui_mark_scroll_view_dirty(uint16_t scrollNode) {
|
|
165
|
+
if (scrollNode >= __ui_node_count) return;
|
|
166
|
+
__ui_nodes[scrollNode].dirty = 1;
|
|
167
|
+
ui_mark_scroll_view_overlaps_dirty(scrollNode);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static inline int16_t ui_scroll_ancestor_for_node(uint16_t nodeIdx) {
|
|
171
|
+
uint16_t p = __ui_nodes[nodeIdx].parent;
|
|
172
|
+
while (p != UI_NO_PARENT && p < __ui_node_count) {
|
|
173
|
+
if (__ui_nodes[p].scrollable) return static_cast<int16_t>(p);
|
|
174
|
+
p = __ui_nodes[p].parent;
|
|
175
|
+
}
|
|
176
|
+
return -1;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static inline void ui_invalidate_scroll_canvas_for_node(uint16_t nodeIdx) {
|
|
180
|
+
int16_t scrollParent = ui_scroll_ancestor_for_node(nodeIdx);
|
|
181
|
+
if (scrollParent < 0) return;
|
|
182
|
+
if (__ui_nodes[scrollParent].virtualized) return;
|
|
183
|
+
if (__ui_nodes[scrollParent].contentHeight <= __ui_nodes[scrollParent].box.h) return;
|
|
184
|
+
int16_t span = __ui_nodes[scrollParent].box.h > 0 ? __ui_nodes[scrollParent].box.h : 1;
|
|
185
|
+
__ui_nodes[scrollParent].lastPaintedScrollY = __ui_nodes[scrollParent].scrollY - span;
|
|
186
|
+
}
|
|
187
|
+
`;
|
|
188
|
+
}
|