From 3c1abee642f41aed290d4b6873a3fcabbed850d4 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期三, 17 十二月 2025 17:03:57 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/tool.js | 8 +++++---
zy-acs-flow/src/map/AreaList.jsx | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/zy-acs-flow/src/map/AreaList.jsx b/zy-acs-flow/src/map/AreaList.jsx
index e242022..629cc4a 100644
--- a/zy-acs-flow/src/map/AreaList.jsx
+++ b/zy-acs-flow/src/map/AreaList.jsx
@@ -49,7 +49,7 @@
}
const sprite = Tool.findAreaSpriteById(area.id);
if (sprite) {
- Tool.focusAreaSprite(sprite);
+ Tool.focusAreaSprite(sprite, 570);
onClose();
setCurSprite(sprite);
}
diff --git a/zy-acs-flow/src/map/tool.js b/zy-acs-flow/src/map/tool.js
index 3d9b4c8..4d53855 100644
--- a/zy-acs-flow/src/map/tool.js
+++ b/zy-acs-flow/src/map/tool.js
@@ -1159,7 +1159,7 @@
setShowAreas(false);
};
-export const focusAreaSprite = (sprite) => {
+export const focusAreaSprite = (sprite, rightPanelWidth) => {
if (!sprite || !app || !mapContainer) {
return;
}
@@ -1176,9 +1176,10 @@
const paddedHeight = (height || 1000) * 1.25;
const viewportWidth = app.renderer.width || 1920;
const viewportHeight = app.renderer.height || 1080;
+ const effectiveViewportWidth = Math.max(1, viewportWidth - rightPanelWidth);
let focusScale = Math.min(
- (viewportWidth * 0.65) / paddedWidth,
+ (effectiveViewportWidth * 0.65) / paddedWidth,
(viewportHeight * 0.65) / paddedHeight
);
focusScale = Math.min(Math.max(focusScale, 0.03), 0.25);
@@ -1189,9 +1190,10 @@
const bounds = sprite.getBounds();
const centerX = bounds.x + bounds.width / 2;
const centerY = bounds.y + bounds.height / 2;
+ const visibleCenterX = (viewportWidth - rightPanelWidth) / 2;
const targetPos = {
- x: viewportWidth / 2 - centerX,
+ x: visibleCenterX - centerX,
y: viewportHeight / 2 - centerY,
};
--
Gitblit v1.9.1