From 77d6a9142252ef29f4f06e4851fbb9ab8fa511e5 Mon Sep 17 00:00:00 2001 From: tianmo Date: Fri, 16 Oct 2026 16:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E6=AE=B5=E9=AB=98=E5=BA=A6=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E7=88=B6=E5=AE=B9=E5=99=A8=EF=BC=9Amiddle=20?= =?UTF-8?q?=3D=20=E7=88=B6=E5=AE=B9=E5=99=A8=E9=AB=98(fillParent=20?= =?UTF-8?q?=E5=89=8D=E8=AF=BB=E5=88=B0=E7=9A=84=20dock)=20=E2=88=92=20?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=AE=B5=20=E2=88=92=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=88=E4=B8=8D=E7=94=A8=20expand=EF=BC=89=EF=BC=9B?= =?UTF-8?q?3=20=E6=AC=A1=E8=BF=AD=E4=BB=A3=E6=94=B6=E6=95=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- viewpanel/src/com/spineview/ObjectPanel.java | 43 ++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/viewpanel/src/com/spineview/ObjectPanel.java b/viewpanel/src/com/spineview/ObjectPanel.java index 6c1c7c9..3603c4b 100644 --- a/viewpanel/src/com/spineview/ObjectPanel.java +++ b/viewpanel/src/com/spineview/ObjectPanel.java @@ -51,6 +51,7 @@ public final class ObjectPanel { Object target; Object root; Object content; + Object buttons; boolean scrollFocusLogged; boolean geometryDumped; Class tableClass; @@ -151,6 +152,7 @@ public final class ObjectPanel { System.err.println("[panel] 设置中段高度失败: " + error); } state.listCell = cell; + state.buttons = buttons; call(root, Obf.TABLE_ROW, new Class[0], cellClass); Object logCell = call(root, Obf.TABLE_ADD, new Class[] {actorClass}, cellClass, state.status); // 下段 = 日志:只占它需要的高度(1~6 行),贴在面板最下面 @@ -213,6 +215,47 @@ public final class ObjectPanel { } catch (Throwable error) { System.err.println("[panel] 开启描边失败: " + error); } + // 中段高度 = **父容器(停靠框)高度** − 按钮段 − 日志段(不用 expand)。 + // 父容器:根表格的 getParent()(载荷里是"无参、返回 Actor/Group 类型"的那个方法)。 + Thread fit = new Thread(new Runnable() { + @Override + public void run() { + try { + Object parent = null; + for (Method m : state.root.getClass().getMethods()) { + if (m.getParameterTypes().length != 0) continue; + String ret = m.getReturnType().getName(); + if (!ret.equals(Obf.ACTOR) && !ret.equals(Obf.GROUP)) continue; + m.setAccessible(true); + Object value = m.invoke(state.root); + 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] 增删改查面板已建好"); refreshList(state); return root;