三段按 600:1400:400 等比缩放到 Stage 高度(略大于停靠框):内容盖过底部,消掉底部空带
This commit is contained in:
1 parent
efeee1fe5a
commit
dc4db3e8fa
1 file changed
+19
-7
@@ -231,18 +231,30 @@ 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;
|
||||
call(logCell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(logH));
|
||||
// 用户要固定高度 600/1400/400;但面板实际高度(root.getHeight)装不下时,
|
||||
// 就按比例缩到刚好装下 —— 反复几轮直到"下面是空的区域1"消失。
|
||||
for (int pass = 0; pass < 3; pass++) {
|
||||
// 用 Stage 高度当"可用高度"(它不随我们的内容变,稳定);比停靠框略大,
|
||||
// 这样内容一定盖过底部,就不会再留出"区域1"那条空带。
|
||||
float available = stageH > 300f ? stageH : panelH;
|
||||
float scale = available / 2400f;
|
||||
float buttonsH = 600f * scale;
|
||||
float middleH = 1400f * scale;
|
||||
float logH = 400f * scale;
|
||||
call(buttonsCell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(buttonsH));
|
||||
call(middleCell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(middleH));
|
||||
call(logCell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(logH));
|
||||
call(state.root, "b_", new Class<?>[0], void.class);
|
||||
Thread.sleep(300);
|
||||
System.err.println("[panel] pass" + pass + " available=" + available + " -> "
|
||||
+ buttonsH + " / " + middleH + " / " + logH);
|
||||
}
|
||||
call(state.root, "b_", new Class<?>[0], void.class);
|
||||
Thread.sleep(800);
|
||||
System.err.println("[panel] 实测高度: root=" + floatOf(state.root, "init")
|
||||
+ " buttonsTable=" + floatOf(state.buttons, "init")
|
||||
+ " logLabel=" + floatOf(state.status, "init"));
|
||||
System.err.println("[panel] 面板高度(自动): stage=" + stageH + " -> " + panelH
|
||||
+ ";三段 = " + buttonsH + " / " + middleH + " / " + logH);
|
||||
System.err.println("[panel] 面板高度(自动): stage=" + stageH + " -> " + panelH);
|
||||
} catch (Throwable error) {
|
||||
System.err.println("[panel] 自动三段高度失败: " + error);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user