From 0ab14eb3b9a43d0857f8c4dee7720a815d0a046e Mon Sep 17 00:00:00 2001 From: Escap1ng Date: Sat, 31 Oct 2026 13:54:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E6=AD=A2=E8=A1=80=20F1-F11=20?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E4=B8=8E=E5=8F=AF=E9=9D=A0=E6=80=A7=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - F1 TreeSpeciesPicker 选中树种后自动关闭弹窗 - F2 背景模式(isBackground)禁用 canvas 拖拽平移 - F3/F4 移动端设置面板:新增 openOnMount 与 close 事件,底部“设置”tab 直接打开面板 - F7 庆祝 toast 定时器保存句柄并在重播/卸载时清理 - F8 fetchTrees 增加 3 次重试,对齐 todos 的启动竞态处理 - F10 仅树 id 集合或地形变化时才重排树木位置,天气变化不再让树瞬移 - F11 SW 注册与 manifest 图标改为相对路径,兼容 base: './' - 森林页补齐 Mountain / Cloud 图标导入,消除未解析组件警告 F5(浮窗监听器累积)经核实已在 0a69457 修复,本次未改动。 --- frontend/public/manifest.json | 2 +- .../src/components/forest/IsometricGrid.vue | 12 +++++++++- .../mobile/layout/AppShellMobile.vue | 14 +++++------- .../src/components/settings/SettingsPanel.vue | 16 ++++++++++---- .../src/components/timer/CircularTimer.vue | 11 ++++++++-- .../components/timer/TreeSpeciesPicker.vue | 3 ++- frontend/src/main.ts | 2 +- frontend/src/stores/forest.ts | 22 ++++++++++++++----- frontend/src/views/ForestViewPage.vue | 4 ++-- frontend/src/views/mobile/HomeView.vue | 2 +- 10 files changed, 61 insertions(+), 27 deletions(-) diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json index 84c622a..0b0381c 100644 --- a/frontend/public/manifest.json +++ b/frontend/public/manifest.json @@ -9,7 +9,7 @@ "orientation": "portrait-primary", "icons": [ { - "src": "/assets/logo.png", + "src": "./assets/logo.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" diff --git a/frontend/src/components/forest/IsometricGrid.vue b/frontend/src/components/forest/IsometricGrid.vue index 2e53b5d..b21c20c 100644 --- a/frontend/src/components/forest/IsometricGrid.vue +++ b/frontend/src/components/forest/IsometricGrid.vue @@ -1341,6 +1341,7 @@ function applyCamera(): void { // ── Panning ── function onPointerDown(e: PointerEvent) { + if (props.isBackground) return if (!(e.target as HTMLElement)?.closest?.('canvas')) return isPanning = true panStart = { x: e.clientX - camX, y: e.clientY - camY } @@ -1497,10 +1498,13 @@ watch(() => props.forceRefresh, () => { }) let prevWeather: WeatherType | null = null +let prevTerrain: TerrainType | null = props.terrain watch(() => [props.trees, props.terrain, props.weather], () => { if (!app) return const weatherChanged = props.weather !== prevWeather prevWeather = props.weather + const terrainChanged = props.terrain !== prevTerrain + prevTerrain = props.terrain // Only restart weather effects when weather actually changed if (weatherChanged) { @@ -1521,7 +1525,13 @@ watch(() => [props.trees, props.terrain, props.weather], () => { for (let gx = 0; gx < cols; gx++) tileKinds[gy][gx] = getTileKind(gx, gy, props.terrain, rows, cols) } - treePlacements.value = assignTreePositions(props.trees, tileKinds, rows, cols) + const idsChanged = + props.trees.length !== treePlacements.value.size || + props.trees.some(t => !treePlacements.value.has(t.id)) + + // Keep positions stable when only weather/object identity (fetchTrees) changes + if (idsChanged || terrainChanged || treePlacements.value.size === 0) + treePlacements.value = assignTreePositions(props.trees, tileKinds, rows, cols) centerCamera() fullRender() diff --git a/frontend/src/components/mobile/layout/AppShellMobile.vue b/frontend/src/components/mobile/layout/AppShellMobile.vue index b08e824..fbe3ed5 100644 --- a/frontend/src/components/mobile/layout/AppShellMobile.vue +++ b/frontend/src/components/mobile/layout/AppShellMobile.vue @@ -17,24 +17,22 @@ 森林 - + +