From fd50db60dcbf548591b0c9bfb47debe1e6a78fd7 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Sat, 4 Apr 2026 02:18:28 +0800 Subject: [PATCH] fix(vishot-runtime): missing scale and coordinate relocate --- .../src/scenes/intro-manual-scene.vue | 24 +++- .../src/components/scenario-canvas.vue | 104 +++++++++++++++++- .../src/runtime/scene-canvas.ts | 31 ++++++ .../src/{__tests__ => test}/exports.test.ts | 0 .../src/{__tests__ => test}/ready.test.ts | 0 .../src/test/scene-canvas.test.ts | 53 +++++++++ 6 files changed, 207 insertions(+), 5 deletions(-) create mode 100644 packages/vishot-runtime/src/runtime/scene-canvas.ts rename packages/vishot-runtime/src/{__tests__ => test}/exports.test.ts (100%) rename packages/vishot-runtime/src/{__tests__ => test}/ready.test.ts (100%) create mode 100644 packages/vishot-runtime/src/test/scene-canvas.test.ts diff --git a/packages/scenarios-stage-tamagotchi-browser/src/scenes/intro-manual-scene.vue b/packages/scenarios-stage-tamagotchi-browser/src/scenes/intro-manual-scene.vue index 7c65ed116..43c9d396b 100644 --- a/packages/scenarios-stage-tamagotchi-browser/src/scenes/intro-manual-scene.vue +++ b/packages/scenarios-stage-tamagotchi-browser/src/scenes/intro-manual-scene.vue @@ -11,6 +11,24 @@ import { PlatformRoot } from '../components/platforms/macos-26' import { Application } from '../components/platforms/macos-26/containers/dock' import { WindowRoot } from '../components/platforms/macos-26/containers/window' +/** + * These coordinates are expressed in the logical `1920x1080` canvas provided by + * `ScenarioCanvas`, not in the browser's live viewport. + * + * That is why the windows keep their relative placement when the viewport size + * changes: the browser scales the entire fixed scene surface after layout rather + * than reinterpreting each translate against a resized responsive container. + */ +const stageWindowStyle = { + left: '1200px', + top: '400px', +} + +const websocketWindowStyle = { + left: '480px', + top: '120px', +} + async function waitForImageSource(source: string): Promise { await new Promise((resolve, reject) => { const image = new Image() @@ -38,14 +56,14 @@ onMounted(async () => {