fix(sdk/hello): P1 z-order重叠(FAB被下层动态控件抹掉,d_redraw→d_paint_region按z栈重画重叠区) + P2 list焦点(命中非list区域释放焦点滚页面) + P3 list脏区(W_LIST裁剪视口,标题栏/底部无残留) (agent-166)
This commit is contained in:
1 parent
6b55cd012b
commit
4afd1abb4a
2 files changed
+172
-10
No files matched your search
+24
-10
@@ -984,26 +984,40 @@ void meow_widget_draw(meow_widget *w)
|
||||
int last = (item > 0) ? (off + vp) / item + 1 : 0;
|
||||
if (first < 0) first = 0;
|
||||
if (last > w->count) last = w->count;
|
||||
/* 视口绝对边界:列表只在其内绘制,杜绝越界泄漏(部分行滚出视口时把填充/分隔线/文本
|
||||
* 画到视口外 → 标脏并上屏 → 标题栏/底部残留脏区,P3)。 */
|
||||
int vx0 = w->x, vy0 = w->y, vx1 = w->x + w->w, vy1 = w->y + w->h;
|
||||
int thh = meow_ui_text_height(th->font_body);
|
||||
for (int i = first; i < last; i++) {
|
||||
char label[64] = "";
|
||||
if (!w->src || !w->src(i, label, (int)sizeof label, w->ctx)) continue;
|
||||
int pos = i * item - off; /* 相对容器起点的可视位置 */
|
||||
if (w->horizontal) {
|
||||
int rx = w->x + pos;
|
||||
if (rx >= w->x + w->w) break;
|
||||
if (i == w->sel) meow_ui_fill_rect(rx, w->y, item, w->h, th->primary);
|
||||
if (rx >= vx1) break; /* 完全在右缘外 */
|
||||
if (rx + item <= vx0) continue; /* 完全在左缘外(滚出残余) */
|
||||
int cl = rx > vx0 ? rx : vx0; /* 可见左界 */
|
||||
int cr = (rx + item) < vx1 ? (rx + item) : vx1; /* 可见右界 */
|
||||
if (i == w->sel) meow_ui_fill_rect(cl, w->y, cr - cl, w->h, th->primary);
|
||||
uint32_t col = (i == w->sel) ? 0xFFFFFF : th->onSurface;
|
||||
meow_ui_text_center(rx + item / 2, w->y + (w->h - meow_ui_text_height(th->font_body)) / 2,
|
||||
label, th->font_body, col);
|
||||
meow_ui_fill_rect(rx + item - 1, w->y, 1, w->h, th->onSurfaceVariant);
|
||||
int ty = w->y + (w->h - thh) / 2;
|
||||
if (rx >= vx0 && rx + item <= vx1) /* 仅整项可见才画文本(防泄漏) */
|
||||
meow_ui_text_center(rx + item / 2, ty, label, th->font_body, col);
|
||||
int sxp = rx + item - 1; /* 分隔线:仅当落在可见区 */
|
||||
if (sxp >= cl && sxp < cr) meow_ui_fill_rect(sxp, w->y, 1, w->h, th->onSurfaceVariant);
|
||||
} else {
|
||||
int ry = w->y + pos;
|
||||
if (ry >= w->y + w->h) break;
|
||||
if (i == w->sel) meow_ui_fill_rect(w->x, ry, w->w, item, th->primary);
|
||||
if (ry >= vy1) break; /* 完全在底缘外 */
|
||||
if (ry + item <= vy0) continue; /* 完全在顶缘外(滚出残余) */
|
||||
int cl = ry > vy0 ? ry : vy0; /* 可见顶界 */
|
||||
int cr = (ry + item) < vy1 ? (ry + item) : vy1; /* 可见底界 */
|
||||
if (i == w->sel) meow_ui_fill_rect(w->x, cl, w->w, cr - cl, th->primary);
|
||||
uint32_t col = (i == w->sel) ? 0xFFFFFF : th->onSurface;
|
||||
meow_ui_text(w->x + pad, ry + (item - meow_ui_text_height(th->font_body)) / 2,
|
||||
label, th->font_body, col);
|
||||
meow_ui_fill_rect(w->x, ry + item - 1, w->w, 1, th->onSurfaceVariant);
|
||||
int ty = ry + (item - thh) / 2;
|
||||
if (ty >= vy0 && ty + thh <= vy1) /* 文本不越界才画(防标题/底部泄漏) */
|
||||
meow_ui_text(w->x + pad, ty, label, th->font_body, col);
|
||||
int sy = ry + item - 1; /* 分隔线:仅当落在可见区 */
|
||||
if (sy >= cl && sy < cr) meow_ui_fill_rect(w->x, sy, w->w, 1, th->onSurfaceVariant);
|
||||
}
|
||||
}
|
||||
if (disabled) meow_ui_fill_rect_alpha(w->x, w->y, w->w, w->h, th->onSurface, 90);
|
||||
|
||||
Reference in new issue
Block a user