fix: tighten viewer framing and localize site controls
Some checks failed
ci / test (macos-latest, 3.10) (push) Has been cancelled
ci / test (macos-latest, 3.12) (push) Has been cancelled
ci / test (ubuntu-latest, 3.10) (push) Has been cancelled
ci / test (ubuntu-latest, 3.12) (push) Has been cancelled
ci / test (windows-latest, 3.10) (push) Has been cancelled
ci / test (windows-latest, 3.12) (push) Has been cancelled
ci / browser-smoke (push) Has been cancelled

This commit is contained in:
2026-07-21 21:10:29 +08:00
parent 84a591c95a
commit 919b35391d

View File

@@ -31,6 +31,12 @@ const preferredCategoryOrder = [
"slab", "roof", "walls", "glazing", "columns", "beams", "slab", "roof", "walls", "glazing", "columns", "beams",
"railings", "doors", "detail_lines", "floor_lines", "grid", "railings", "doors", "detail_lines", "floor_lines", "grid",
]; ];
const SCENE_FLOOR_LABELS = {
SITE: "场地",
ROADS: "道路",
FENCE: "围墙",
TREES: "绿化",
};
const CACHE_BUST = "{{BUILD}}"; const CACHE_BUST = "{{BUILD}}";
// Tour presets — cycle through these viewpoints // Tour presets — cycle through these viewpoints
@@ -360,7 +366,7 @@ function buildFloorControls(meta) {
floorList.append( floorList.append(
createToggle({ createToggle({
key: fk, key: fk,
label: fk, label: SCENE_FLOOR_LABELS[fk] || fk,
checked: state.floors[fk], checked: state.floors[fk],
onChange: (checked) => { onChange: (checked) => {
state.floors[fk] = checked; state.floors[fk] = checked;
@@ -790,11 +796,12 @@ function fitCamera(preset) {
const size = box.getSize(new THREE.Vector3()); const size = box.getSize(new THREE.Vector3());
const maxSize = Math.max(size.x, size.y, size.z, 1); const maxSize = Math.max(size.x, size.y, size.z, 1);
if (preset === "top") { if (preset === "top") {
camera.position.set(center.x, center.y + maxSize * 1.45, center.z); camera.position.set(center.x, center.y + maxSize * 1.22, center.z);
} else if (preset === "side") { } else if (preset === "side") {
camera.position.set(center.x, center.y + maxSize * 0.18, center.z + maxSize * 1.35); camera.position.set(center.x, center.y + maxSize * 0.18, center.z + maxSize * 1.15);
} else { } else {
const d = maxSize * 1.4; // 园区模型默认占据更多画面;OrbitControls 仍允许用户自由拉远。
const d = maxSize * 1.15;
const L = Math.hypot(0.55, 1.0, 0.7); const L = Math.hypot(0.55, 1.0, 0.7);
camera.position.set(center.x - (0.55 / L) * d, center.y + (1.0 / L) * d, center.z + (0.7 / L) * d); camera.position.set(center.x - (0.55 / L) * d, center.y + (1.0 / L) * d, center.z + (0.7 / L) * d);
} }