恢复热端场景视角操作并仅停止圆形部件自转

This commit is contained in:
xuans 2026-09-18 22:41:32 +08:00
parent c5b338633e
commit e1eb07ac4c
3 changed files with 9 additions and 13 deletions

View File

@ -48,7 +48,7 @@ try {
const after = await pixels(); const after = await pixels();
report.changedPixels = after.filter((v, i) => v !== before[i]).length; report.changedPixels = after.filter((v, i) => v !== before[i]).length;
assert.ok(report.changedPixels > 50); assert.ok(report.changedPixels > 50);
assert.notEqual((await signal()).fanAngle, start.fanAngle); assert.equal((await signal()).fanAngle, start.fanAngle);
assert.deepEqual((await signal()).cameraPosition, start.cameraPosition); assert.deepEqual((await signal()).cameraPosition, start.cameraPosition);
assert.deepEqual((await signal()).cameraQuaternion, start.cameraQuaternion); assert.deepEqual((await signal()).cameraQuaternion, start.cameraQuaternion);
const sceneBounds = await page.locator('#scene').boundingBox(); const sceneBounds = await page.locator('#scene').boundingBox();
@ -56,12 +56,13 @@ try {
await page.mouse.down(); 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.move(sceneBounds.x + sceneBounds.width / 2 + 100, sceneBounds.y + sceneBounds.height / 2 + 60, { steps: 12 });
await page.mouse.up(); await page.mouse.up();
await page.mouse.wheel(0, 300);
await page.waitForTimeout(500); await page.waitForTimeout(500);
assert.deepEqual((await signal()).cameraPosition, start.cameraPosition); assert.notDeepEqual((await signal()).cameraPosition, start.cameraPosition);
assert.deepEqual((await signal()).cameraQuaternion, start.cameraQuaternion); assert.notDeepEqual((await signal()).cameraQuaternion, start.cameraQuaternion);
assert.equal((await signal()).fanAngle, start.fanAngle);
assert.ok((await signal()).travel > start.travel); assert.ok((await signal()).travel > start.travel);
report.fixedSectionCamera = true; report.fixedComponentRotation = true;
report.interactiveCamera = true;
await page.screenshot({ path: "artifacts/thermal-animation.png" }); await page.screenshot({ path: "artifacts/thermal-animation.png" });
await page.locator("#fan-target").fill("0"); await page.locator("#fan-target").fill("0");
await page.waitForTimeout(300); await page.waitForTimeout(300);

View File

@ -169,11 +169,6 @@ export class MonitorScene extends PrintScene {
} }
setTechnology(mode) { 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.mode = mode;
this.releaseGroup.visible = mode === "nozzle"; this.releaseGroup.visible = mode === "nozzle";
this.nozzleScene.overlay.hidden = mode !== "nozzle"; this.nozzleScene.overlay.hidden = mode !== "nozzle";
@ -183,11 +178,11 @@ export class MonitorScene extends PrintScene {
if (mode === "nozzle") { if (mode === "nozzle") {
this.nozzleScene.focus(); this.nozzleScene.focus();
} else if (mode === "thermal") { } else if (mode === "thermal") {
const direction = new THREE.Vector3(0, 28, 125); const direction = new THREE.Vector3(25, 55, 125);
direction.multiplyScalar(1 / Math.min(1, this.camera.aspect)); direction.multiplyScalar(1 / Math.min(1, this.camera.aspect));
if (this.camera.aspect < 1) direction.multiplyScalar(1.25); if (this.camera.aspect < 1) direction.multiplyScalar(1.25);
this.camera.position.copy(direction);
this.controls.target.set(-9, 27, 0); this.controls.target.set(-9, 27, 0);
this.camera.position.copy(this.controls.target).add(direction);
this.controls.update(); this.controls.update();
} else this.setView("perspective"); } else this.setView("perspective");
} }
@ -201,6 +196,7 @@ export class MonitorScene extends PrintScene {
this.workflow.group.visible = false; this.workflow.group.visible = false;
this.thermalScene.update(options.thermalSignal); this.thermalScene.update(options.thermalSignal);
this.controls.autoRotate = false; this.controls.autoRotate = false;
this.controls.update();
this.renderer.render(this.scene, this.camera); this.renderer.render(this.scene, this.camera);
return; return;
} }

View File

@ -182,7 +182,6 @@ export class ThermalScene {
if (!signal.paused) { if (!signal.paused) {
this.time += delta; this.time += delta;
this.travel += (delta * 14 * signal.feed) / 100; this.travel += (delta * 14 * signal.feed) / 100;
this.fan.rotation.z -= (delta * 16 * signal.fan) / 100;
} }
const hot = THREE.MathUtils.clamp((signal.nozzle - 25) / 240, 0, 1); const hot = THREE.MathUtils.clamp((signal.nozzle - 25) / 240, 0, 1);
this.heater.material.color.setRGB( this.heater.material.color.setRGB(