中段固定高度:Cell.I(float)=height(实测确认:设 900 → 根表格 580->1080;设后列表区出现滚动条可滚)。值先取 700,并把该映射写进 anchors.tsv/names.tsv

This commit is contained in:
tianmo committed 2026-10-16 16:50:16 +08:00
1 parent a5307021f3
commit 05e2d1b074
3 files changed
+28 -62

No files matched your search

+22 -61
View File
@@ -148,6 +148,13 @@ public final class ObjectPanel {
layoutCell(logCell, Obf.CELL_LEFT);
cell = call(root, Obf.TABLE_ADD, new Class<?>[] {actorClass}, cellClass, content);
layoutCell(cell, Obf.CELL_EXPAND, Obf.CELL_FILL);
// 中段高度固定:Cell.height(float) 在载荷里叫 `I`(描述符 (F)LdR;)
// 实测确认:设 900 后根表格高度 580 -> 1080,说明它就是 height()。
try {
call(cell, "I", new Class<?>[] {float.class}, cellClass, Float.valueOf(700f));
} catch (Throwable error) {
System.err.println("[panel] 设置中段高度失败: " + error);
}
wire(loader, setValue, new Runnable() {
@Override
@@ -191,67 +198,6 @@ public final class ObjectPanel {
});
startSelectionWatcher(state);
// 一次性诊断:等布局稳定后把 ScrollPane / 日志 Label 的几何打出来(只读,不改行为)
Thread measure = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2500);
} catch (InterruptedException ignored) {
return;
}
StringBuilder a = new StringBuilder("[panel] 列表 ScrollPane 几何: ");
for (Method m : state.listScroll.getClass().getMethods()) {
if (m.getParameterTypes().length != 0 || m.getReturnType() != float.class) continue;
try {
m.setAccessible(true);
a.append(m.getName()).append('=').append(m.invoke(state.listScroll)).append(' ');
} catch (Throwable ignored) {
// 跳过
}
}
StringBuilder b = new StringBuilder("[panel] 日志 Label 几何: ");
for (Method m : state.status.getClass().getMethods()) {
if (m.getParameterTypes().length != 0 || m.getReturnType() != float.class) continue;
try {
m.setAccessible(true);
b.append(m.getName()).append('=').append(m.invoke(state.status)).append(' ');
} catch (Throwable ignored) {
// 跳过
}
}
// 同一方法名在 root/content/pane 上各读一遍:真正的 getWidth/getHeight 会给出"面板那么大"的数
for (Method m : state.listScroll.getClass().getMethods()) {
if (m.getParameterTypes().length != 0 || m.getReturnType() != float.class) continue;
String name = m.getName();
StringBuilder row = new StringBuilder("[panel] " + name + ": ");
Object[] targets = {state.root, state.content, state.listScroll, state.status};
String[] tags = {"root", "content", "pane", "log"};
for (int i = 0; i < targets.length; i++) {
if (targets[i] == null) continue;
try {
Method same = null;
for (Method candidate : targets[i].getClass().getMethods()) {
if (candidate.getName().equals(name)
&& candidate.getParameterTypes().length == 0
&& candidate.getReturnType() == float.class) {
same = candidate;
break;
}
}
if (same == null) continue;
same.setAccessible(true);
row.append(tags[i]).append('=').append(same.invoke(targets[i])).append(' ');
} catch (Throwable ignored) {
// 跳过
}
}
System.err.println(row.toString());
}
}
}, "spineview-measure");
measure.setDaemon(true);
measure.start();
System.err.println("[panel] 增删改查面板已建好");
refreshList(state);
return root;
@@ -817,6 +763,21 @@ public final class ObjectPanel {
}
}
/** 读某个对象的某个无参 float 方法(诊断用)。 */
static float floatOf(Object target, String name) {
try {
for (Method m : target.getClass().getMethods()) {
if (!m.getName().equals(name)) continue;
if (m.getParameterTypes().length != 0 || m.getReturnType() != float.class) continue;
m.setAccessible(true);
return ((Float) m.invoke(target)).floatValue();
}
} catch (Throwable ignored) {
// 读不到
}
return -1f;
}
private static float readFloat(Object target, String name) {
try {
for (Method method : target.getClass().getMethods()) {