三段按 600:1400:400 的比例缩放到面板高度(原来三个数合计 2400 超过面板,被 libGDX 压扁导致比例看着不对)

This commit is contained in:
tianmo committed 2026-10-16 17:12:36 +08:00
1 parent 2a02984b79
commit 4505c50af1
1 file changed
+5 -4
+5 -4
View File
@@ -231,10 +231,11 @@ public final class ObjectPanel {
// Stage 上:`B()F`=getHeight、`D()F`=getWidth(实测:4K 窗口 2044 / 3726)
if (stage != null) stageH = floatOf(stage, "B");
float panelH = stageH > 300f ? stageH - 100f : 984f;
// 用户指定(固定值):上段 600、中段 1400、日志段 400
float buttonsH = 600f;
float middleH = 1400f;
float logH = 400f;
// 用户要的比例:上 600 : 中 1400 : 日志 400。三者按面板高度等比缩放,保证铺满、比例不变。
float scale = panelH / 2400f;
float buttonsH = 600f * scale;
float middleH = 1400f * scale;
float logH = 400f * scale;
call(logCell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(logH));
call(state.root, "b_", new Class<?>[0], void.class);
System.err.println("[panel] 面板高度(自动): stage=" + stageH + " -> " + panelH