From 6a6414510e8ff172e52de19dd82fbd7991c19c65 Mon Sep 17 00:00:00 2001 From: cocos02 Date: Fri, 12 Jun 2026 16:23:49 +0800 Subject: [PATCH] feat: add transform:scale() UI scaling for 1920x1080 canvas --- editor/index.html | 9 ++++++++- editor/main.ts | 7 +++++++ index.html | 8 ++++++++ src/App.vue | 4 ---- src/main.ts | 7 +++++++ 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/editor/index.html b/editor/index.html index 9fbad33..12846b8 100644 --- a/editor/index.html +++ b/editor/index.html @@ -4,7 +4,14 @@ 剧情编辑器 — 交互式电影游戏 - +
diff --git a/editor/main.ts b/editor/main.ts index 4aaa1b5..58590d5 100644 --- a/editor/main.ts +++ b/editor/main.ts @@ -2,6 +2,13 @@ import { createApp } from 'vue' import { createPinia } from 'pinia' import EditorApp from './App.vue' +function applyScale() { + const s = Math.min(window.innerWidth / 1920, window.innerHeight / 1080) + document.documentElement.style.setProperty('--scale', String(s)) +} +applyScale() +window.addEventListener('resize', applyScale) + const app = createApp(EditorApp) app.use(createPinia()) app.mount('#editor-app') diff --git a/index.html b/index.html index c71929e..bd7621a 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,14 @@ 交互式电影游戏 +
diff --git a/src/App.vue b/src/App.vue index 49e7239..10283dc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -405,10 +405,6 @@ html, body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; } -#app { - width: 100%; - height: 100%; -}