From a44559dcda91a500644b4aa0dd301a9b2b2abfd4 Mon Sep 17 00:00:00 2001 From: xuans Date: Fri, 18 Sep 2026 22:29:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E7=83=AD=E7=AB=AF=E7=86=94?= =?UTF-8?q?=E8=9E=8D=E5=8C=BA=E5=89=96=E9=9D=A2=E8=A7=86=E8=A7=92=E5=B9=B6?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E5=B7=A5=E8=89=BA=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/verify-thermal.js | 15 ++++++++++++++- src/views/Monitor/Scene.js | 10 +++++++--- src/views/Monitor/ThermalScene.js | 2 ++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/scripts/verify-thermal.js b/scripts/verify-thermal.js index 698daa5..59a3464 100644 --- a/scripts/verify-thermal.js +++ b/scripts/verify-thermal.js @@ -27,7 +27,7 @@ try { await page.goto(url); await page.waitForSelector("#loading[hidden]", { state: "attached", - timeout: 60000, + timeout: 180000, }); await page.locator('[data-technology="thermal"]').click(); const signal = () => @@ -49,6 +49,19 @@ try { report.changedPixels = after.filter((v, i) => v !== before[i]).length; assert.ok(report.changedPixels > 50); assert.notEqual((await signal()).fanAngle, start.fanAngle); + assert.deepEqual((await signal()).cameraPosition, start.cameraPosition); + assert.deepEqual((await signal()).cameraQuaternion, start.cameraQuaternion); + const sceneBounds = await page.locator('#scene').boundingBox(); + await page.mouse.move(sceneBounds.x + sceneBounds.width / 2, sceneBounds.y + sceneBounds.height / 2); + await page.mouse.down(); + await page.mouse.move(sceneBounds.x + sceneBounds.width / 2 + 100, sceneBounds.y + sceneBounds.height / 2 + 60, { steps: 12 }); + await page.mouse.up(); + await page.mouse.wheel(0, 300); + await page.waitForTimeout(500); + assert.deepEqual((await signal()).cameraPosition, start.cameraPosition); + assert.deepEqual((await signal()).cameraQuaternion, start.cameraQuaternion); + assert.ok((await signal()).travel > start.travel); + report.fixedSectionCamera = true; await page.screenshot({ path: "artifacts/thermal-animation.png" }); await page.locator("#fan-target").fill("0"); await page.waitForTimeout(300); diff --git a/src/views/Monitor/Scene.js b/src/views/Monitor/Scene.js index f25194e..8dfef23 100644 --- a/src/views/Monitor/Scene.js +++ b/src/views/Monitor/Scene.js @@ -169,6 +169,11 @@ export class MonitorScene extends PrintScene { } setTechnology(mode) { + this.controls.autoRotate = false; + this.controls.enableDamping = false; + this.controls.update(); + this.controls.enableDamping = true; + this.controls.enabled = mode !== 'thermal'; this.mode = mode; this.releaseGroup.visible = mode === "nozzle"; this.nozzleScene.overlay.hidden = mode !== "nozzle"; @@ -178,11 +183,11 @@ export class MonitorScene extends PrintScene { if (mode === "nozzle") { this.nozzleScene.focus(); } else if (mode === "thermal") { - const direction = new THREE.Vector3(25, 55, 125); + const direction = new THREE.Vector3(0, 28, 125); direction.multiplyScalar(1 / Math.min(1, this.camera.aspect)); if (this.camera.aspect < 1) direction.multiplyScalar(1.25); - this.camera.position.copy(direction); this.controls.target.set(-9, 27, 0); + this.camera.position.copy(this.controls.target).add(direction); this.controls.update(); } else this.setView("perspective"); } @@ -196,7 +201,6 @@ export class MonitorScene extends PrintScene { this.workflow.group.visible = false; this.thermalScene.update(options.thermalSignal); this.controls.autoRotate = false; - this.controls.update(); this.renderer.render(this.scene, this.camera); return; } diff --git a/src/views/Monitor/ThermalScene.js b/src/views/Monitor/ThermalScene.js index 2ff389d..28c65eb 100644 --- a/src/views/Monitor/ThermalScene.js +++ b/src/views/Monitor/ThermalScene.js @@ -237,6 +237,8 @@ export class ThermalScene { }); this.filament.position.y = 52 + Math.sin(this.time * 5) * 0.7; this.host.container.dataset.thermal = JSON.stringify({ + cameraPosition: this.host.camera.position.toArray(), + cameraQuaternion: this.host.camera.quaternion.toArray(), fanAngle: this.fan.rotation.z, travel: this.travel, power: signal.power,