三段高度按 20/60/20 计算,面板高度可配置:-Dpanel.h=<像素>(默认 984,run.sh 支持 PANEL_H 环境变量)——4K 屏窗口更大时用得上
This commit is contained in:
1 parent
77d6a91422
commit
84a8f30811
2 files changed
+16
-41
No files matched your search
@@ -37,6 +37,7 @@ cmd = [jx,
|
|||||||
"-Dspine.payload=" + pay,
|
"-Dspine.payload=" + pay,
|
||||||
"-Dspine.resources=" + here + "/resources",
|
"-Dspine.resources=" + here + "/resources",
|
||||||
"-Dspine.compat=" + here + "/compat-classes",
|
"-Dspine.compat=" + here + "/compat-classes",
|
||||||
|
"-Dpanel.h=" + (os.environ.get("PANEL_H") or "984"),
|
||||||
"-Dspine.classes=" + here + "/build/classes",
|
"-Dspine.classes=" + here + "/build/classes",
|
||||||
"-Duser.home=" + root + "/spine-lab/home",
|
"-Duser.home=" + root + "/spine-lab/home",
|
||||||
"-cp", here + "/build/classes:" + root + "/tools/asm/asm.jar:" + root + "/tools/asm/asm-tree.jar",
|
"-cp", here + "/build/classes:" + root + "/tools/asm/asm.jar:" + root + "/tools/asm/asm-tree.jar",
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ public final class ObjectPanel {
|
|||||||
// 上段:按钮块(自适应高度,紧贴顶部)
|
// 上段:按钮块(自适应高度,紧贴顶部)
|
||||||
Object cell = call(root, Obf.TABLE_ADD, new Class<?>[] {actorClass}, cellClass, buttons);
|
Object cell = call(root, Obf.TABLE_ADD, new Class<?>[] {actorClass}, cellClass, buttons);
|
||||||
layoutCell(cell, Obf.CELL_LEFT, Obf.CELL_FILL_X);
|
layoutCell(cell, Obf.CELL_LEFT, Obf.CELL_FILL_X);
|
||||||
|
final Object buttonsCell = cell;
|
||||||
call(root, Obf.TABLE_ROW, new Class<?>[0], cellClass);
|
call(root, Obf.TABLE_ROW, new Class<?>[0], cellClass);
|
||||||
// 上/中/下 = 根表格的**三个单元格**(这样 setDebug 画出来就是三条带):
|
// 上/中/下 = 根表格的**三个单元格**(这样 setDebug 画出来就是三条带):
|
||||||
// 上 = 按钮块(已经在上面加过)
|
// 上 = 按钮块(已经在上面加过)
|
||||||
@@ -215,47 +216,20 @@ public final class ObjectPanel {
|
|||||||
} catch (Throwable error) {
|
} catch (Throwable error) {
|
||||||
System.err.println("[panel] 开启描边失败: " + error);
|
System.err.println("[panel] 开启描边失败: " + error);
|
||||||
}
|
}
|
||||||
// 中段高度 = **父容器(停靠框)高度** − 按钮段 − 日志段(不用 expand)。
|
// 三段高度按用户要求:上 20% / 中 60% / 下 20%(不用 expand)。
|
||||||
// 父容器:根表格的 getParent()(载荷里是"无参、返回 Actor/Group 类型"的那个方法)。
|
// 面板高度取实测值 984(见日志 pass0 dock=984),换算 = 197 / 590 / 197。
|
||||||
Thread fit = new Thread(new Runnable() {
|
// 面板高度:默认取实测值 984(本机逻辑高度),可用 -Dpanel.h=<像素> 覆盖(4K/不同窗口大小用)。
|
||||||
@Override
|
final float PANEL_H = Float.parseFloat(System.getProperty("panel.h", "984"));
|
||||||
public void run() {
|
try {
|
||||||
try {
|
call(buttonsCell, "I", new Class<?>[] {float.class}, cellClass,
|
||||||
Object parent = null;
|
Float.valueOf(PANEL_H * 0.20f));
|
||||||
for (Method m : state.root.getClass().getMethods()) {
|
call(cell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(PANEL_H * 0.60f));
|
||||||
if (m.getParameterTypes().length != 0) continue;
|
call(logCell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(PANEL_H * 0.20f));
|
||||||
String ret = m.getReturnType().getName();
|
System.err.println("[panel] 三段高度: " + (PANEL_H * 0.20f) + " / " + (PANEL_H * 0.60f)
|
||||||
if (!ret.equals(Obf.ACTOR) && !ret.equals(Obf.GROUP)) continue;
|
+ " / " + (PANEL_H * 0.20f));
|
||||||
m.setAccessible(true);
|
} catch (Throwable error) {
|
||||||
Object value = m.invoke(state.root);
|
System.err.println("[panel] 设置三段高度失败: " + error);
|
||||||
if (value != null) {
|
}
|
||||||
parent = value;
|
|
||||||
System.err.println("[panel] 面板父容器 = " + value.getClass().getName()
|
|
||||||
+ " via " + m.getDeclaringClass().getName() + "." + m.getName());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int pass = 0; pass < 3; pass++) {
|
|
||||||
Thread.sleep(500);
|
|
||||||
float dockHeight = parent == null ? floatOf(state.root, "init") : floatOf(parent, "init");
|
|
||||||
float buttonsHeight = floatOf(state.buttons, "init");
|
|
||||||
float logHeight = floatOf(state.status, "init");
|
|
||||||
float middle = dockHeight - buttonsHeight - logHeight - 12f;
|
|
||||||
if (middle < 120f) middle = 120f;
|
|
||||||
call(state.listCell, "I", new Class<?>[] {float.class}, state.cellClass,
|
|
||||||
Float.valueOf(middle));
|
|
||||||
call(state.root, "b_", new Class<?>[0], void.class);
|
|
||||||
call(state.listScroll, "b_", new Class<?>[0], void.class);
|
|
||||||
System.err.println("[panel] pass" + pass + " dock=" + dockHeight + " buttons="
|
|
||||||
+ buttonsHeight + " log=" + logHeight + " -> middle=" + middle);
|
|
||||||
}
|
|
||||||
} catch (Throwable error) {
|
|
||||||
System.err.println("[panel] 自适应中段高度失败: " + error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, "spineview-fit-middle");
|
|
||||||
fit.setDaemon(true);
|
|
||||||
fit.start();
|
|
||||||
System.err.println("[panel] 增删改查面板已建好");
|
System.err.println("[panel] 增删改查面板已建好");
|
||||||
refreshList(state);
|
refreshList(state);
|
||||||
return root;
|
return root;
|
||||||
|
|||||||
Reference in new issue
Block a user