From f9c1caab67942036e52e6f30a7b9b608df08159b Mon Sep 17 00:00:00 2001 From: zihanjian Date: Fri, 6 Jun 2025 15:29:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=82=AC=E6=B5=AE=E8=B0=83?= =?UTF-8?q?=E8=89=B2=E7=9B=98=E7=BB=84=E4=BB=B6=E7=9A=84=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=AE=A1=E7=AE=97=EF=BC=8C=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E5=B7=A6=E8=BE=B9=E7=BC=98=E5=9C=A8=E5=B1=8F=E5=B9=95=E5=86=85?= =?UTF-8?q?=E5=B9=B6=E8=B0=83=E6=95=B4=E8=BE=B9=E7=95=8C=E9=99=90=E5=88=B6?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E4=BD=93=E9=AA=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FloatingColorPalette.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/FloatingColorPalette.tsx b/src/components/FloatingColorPalette.tsx index 5a10629..4ad4448 100644 --- a/src/components/FloatingColorPalette.tsx +++ b/src/components/FloatingColorPalette.tsx @@ -45,10 +45,10 @@ const FloatingColorPalette: React.FC = ({ isActive, onActivate }) => { - // 计算初始位置,确保在屏幕内显示 + // 计算初始位置,确保左边缘在屏幕内(小屏幕时右边缘可以超出) const getInitialPosition = () => ({ - x: Math.max(20, Math.min(20, window.innerWidth - 300)), - y: Math.max(100, Math.min(100, window.innerHeight - 400)) + x: Math.max(0, Math.min(20, window.innerWidth - 280)), // 确保左边缘至少是0 + y: Math.max(0, Math.min(100, window.innerHeight - 400)) // 确保上边缘至少是0 }); const [position, setPosition] = useState({ x: 20, y: 100 });