修 run.sh(漏 import os,导致编辑器根本起不来)+ 三段高度 20/60/20 自动按 Stage 高度算(实测 Stage.B()F=getHeight:4K 窗口 2044)

This commit is contained in:
tianmo committed 2026-10-16 17:07:41 +08:00
1 parent 84a8f30811
commit 05c5d45cca
4 files changed
+36 -13

No files matched your search

+28 -12
View File
@@ -218,18 +218,34 @@ public final class ObjectPanel {
}
// 三段高度按用户要求:上 20% / 中 60% / 下 20%(不用 expand)。
// 面板高度取实测值 984(见日志 pass0 dock=984),换算 = 197 / 590 / 197。
// 面板高度:默认取实测值 984(本机逻辑高度),可用 -Dpanel.h=<像素> 覆盖(4K/不同窗口大小用)。
final float PANEL_H = Float.parseFloat(System.getProperty("panel.h", "984"));
try {
call(buttonsCell, "I", new Class<?>[] {float.class}, cellClass,
Float.valueOf(PANEL_H * 0.20f));
call(cell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(PANEL_H * 0.60f));
call(logCell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(PANEL_H * 0.20f));
System.err.println("[panel] 三段高度: " + (PANEL_H * 0.20f) + " / " + (PANEL_H * 0.60f)
+ " / " + (PANEL_H * 0.20f));
} catch (Throwable error) {
System.err.println("[panel] 设置三段高度失败: " + error);
}
// 三段高度 20/60/20:面板高度从编辑器 Stage 读(建面板时 Stage 可能还没挂上,延迟 1.2s 再读)
final Object middleCell = cell;
Thread fit = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1200);
float stageH = 0f;
Object stage = SceneObjects.global(state.loader, "uk");
if (stage == null) stage = SceneObjects.global(state.loader, "dt");
// Stage 上:`B()F`=getHeight、`D()F`=getWidth(实测:4K 窗口 2044 / 3726)
if (stage != null) stageH = floatOf(stage, "B");
float panelH = stageH > 300f ? stageH - 100f : 984f;
call(buttonsCell, "I", new Class<?>[] {float.class}, cellClass,
Float.valueOf(panelH * 0.2f));
call(middleCell, "I", new Class<?>[] {float.class}, cellClass,
Float.valueOf(panelH * 0.6f));
call(logCell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(panelH * 0.2f));
call(state.root, "b_", new Class<?>[0], void.class);
System.err.println("[panel] 面板高度(自动): stage=" + stageH + " -> " + panelH
+ ";三段 = " + (panelH * 0.2f) + " / " + (panelH * 0.6f) + " / " + (panelH * 0.2f));
} catch (Throwable error) {
System.err.println("[panel] 自动三段高度失败: " + error);
}
}
}, "spineview-fit");
fit.setDaemon(true);
fit.start();
System.err.println("[panel] 增删改查面板已建好");
refreshList(state);
return root;