fix(hello): demo 左滑列表行高按字体行高派生 — 首行标题不再丢失(M17)
根因(承接 M12/M15 finding):SDK meow_listview 双行 renderer 把 block = 2*meow_ui_text_height(font_body) + MEOW_LISTV_SUB_GAP(2) 在行内垂直居中 (ty = 行顶 + (item - block)/2),标题只在 ty >= 视口顶时才画。demo 的 swipe 列表 显式 set_item_renderer(2,1,0)(双行档位)却 set_item_h(48):真机 source_han_serif 20px 行高 30 → block 62 → ty = 行顶 - 7,首行「notif 0」标题被裁剪守卫整条跳过, 只剩 swipe left 副标题。 修复: - hello_internal.h:新增 HELLO_ROW_H_MIN(56) / HELLO_ROW_SUB_GAP(2,与 SDK MEOW_LISTV_SUB_GAP 同口径) + hello_row_h_for_line_h(line_h) = max(56, 2*line_h + 2) + hello_row_h()(取当前主题 font_body 的 meow_ui_text_height)。本地派生,不依赖 M15 新增导出 meow_listview_item_h; 显式传值在 M15 之前的 SDK(默认 48/56 档位)与 M15 之后(默认已派生 62)都成立且一致。 - ui/demo/sdk2/sdk2.c:set_item_h(48) 改传 hello_row_h()(行高 30 → 62)。 列表视口 LV_H / 三节布局推进量不变(行高只影响行内几何与滚动量),其它 demo 区块 (LazyColumn 列表、宫格、选择器)不受影响。 验证(宿主,未碰真机): - zig-mipsel-cc -Os -static -Wall -Wextra(另用 -Werror 复验)交叉编译 hello:0 warning; - 新宿主 test/test_row_text_fit.c(32 断言,纯头文件派生、不链 SDK): 字库行高矩阵 14/21/26/27/30 下 block <= item、首行 ty >= 0;行高 30 → 62; 旧 48 → ty=-7 的 bug 形态哨兵;全 PASS。 影响:meow_ui.a 未改 → 无需重编 SDK;本 App 需重链重部署(热更 hello 二进制)。
This commit is contained in:
1 parent
e69b8efeeb
commit
9600f10352
3 files changed
+113
-1
No files matched your search
@@ -33,6 +33,31 @@ extern meow_sheet *g_sheet; /* BottomSheet(阻塞模态;main 创建
|
||||
typedef struct { int x, y, w, h; } rect_t;
|
||||
#define RX(x,y,w,h) ((rect_t){ (x), (y), (w), (h) })
|
||||
|
||||
/* ---- 两行列表行高:按字体行高派生(M17,首行标题不显示根因修复)----
|
||||
* SDK meow_listview 的双行渲染把「标题+副标题」文本块
|
||||
* block = 2 * meow_ui_text_height(font_body) + MEOW_LISTV_SUB_GAP(2)
|
||||
* 在行内垂直居中(ty = 行顶 + (item - block) / 2),标题只在 ty >= 视口顶时才画。
|
||||
* item < block 时 ty = 行顶 - Δ:第一行(行顶 == 视口顶)标题被整条跳过、只剩副标题。
|
||||
* 真机 source_han_serif 20px(ascent 24 + descent 6)行高 30 → block 62;demo 的 swipe 列表
|
||||
* 是双行档位(set_item_renderer(2,...)),旧的显式 48 比 block 小 14 → 首行标题必丢。
|
||||
* 故行高按当前主题正文行高派生:max(HELLO_ROW_H_MIN, 2*line_h + 2)(行高 30 → 62)。
|
||||
* 行几何(draw / hit / max_scroll)全由 SDK 按传入的这一个值换算,滚动与命中天然同步。 */
|
||||
#define HELLO_ROW_H_MIN 56
|
||||
#define HELLO_ROW_SUB_GAP 2 /* 与 SDK MEOW_LISTV_SUB_GAP 同口径(标题/副标题行距) */
|
||||
|
||||
static inline int hello_row_h_for_line_h(int line_h)
|
||||
{
|
||||
if (line_h < 1) line_h = 1; /* 字体未就绪 → 退回下限 */
|
||||
int h = 2 * line_h + HELLO_ROW_SUB_GAP;
|
||||
return (h > HELLO_ROW_H_MIN) ? h : HELLO_ROW_H_MIN;
|
||||
}
|
||||
/* 当前主题正文行高下的两行列表行高(建列表时取一次;字体档位切换走内容重建)。 */
|
||||
static inline int hello_row_h(void)
|
||||
{
|
||||
const meow_theme *th = meow_theme_get();
|
||||
return hello_row_h_for_line_h(th ? meow_ui_text_height(th->font_body) : 0);
|
||||
}
|
||||
|
||||
/* ---- 视图控制器(ctx = biz-UI 绑定点)----
|
||||
* 本批控制器为薄壳:持 meow_view 回指针;页面细粒度视图态(g_ds/g_drag_* /scroll 等)留在各页
|
||||
* 模块作用域全局(设计定案 B:demo 视图态不迁 logic)。控制器未来可吸收这些状态。 */
|
||||
|
||||
Reference in new issue
Block a user