This commit is contained in:
2026-06-29 18:29:33 +08:00
parent 63c2f0fb33
commit 188119009e
3 changed files with 14 additions and 19 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -28,7 +28,7 @@
}
})();
</script>
<script type="module" crossorigin src="/assets/index-Qg4hmCnl.js"></script>
<script type="module" crossorigin src="/assets/index-5zGykAoi.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D3IaMBsq.css">
</head>
<body>
@@ -152,7 +152,7 @@ const AppLayout: React.FC = () => {
}));
const [isDragging, setIsDragging] = useState(false);
const hasMovedRef = useRef(false);
const dragOffsetRef = useRef({ x: 0, y: 0 });
const dragStartRef = useRef({ x: 0, y: 0 });
const [mobileExpandedMenus, setMobileExpandedMenus] = useState<Record<string, boolean>>({});
const [siteName, setSiteName] = useState(() => {
const cached = localStorage.getItem('siteInfo');
@@ -218,9 +218,9 @@ const AppLayout: React.FC = () => {
if (e.button === 0) {
setIsDragging(true);
hasMovedRef.current = false;
dragOffsetRef.current = {
x: e.clientX - contactPosition.x,
y: e.clientY - contactPosition.y,
dragStartRef.current = {
x: e.clientX,
y: e.clientY,
};
}
};
@@ -228,28 +228,24 @@ const AppLayout: React.FC = () => {
const handleContactMouseMove = (e: MouseEvent) => {
if (!isDragging) return;
const deltaY = Math.abs(e.clientY - (contactPosition.y + dragOffsetRef.current.y));
if (deltaY > 2) {
const deltaX = Math.abs(e.clientX - dragStartRef.current.x);
const deltaY = Math.abs(e.clientY - dragStartRef.current.y);
if (deltaX > 5 || deltaY > 5) {
hasMovedRef.current = true;
}
const newY = Math.max(60, Math.min(window.innerHeight - 60, e.clientY - dragOffsetRef.current.y));
const newY = Math.max(60, Math.min(window.innerHeight - 60, e.clientY - (dragStartRef.current.y - contactPosition.y)));
setContactPosition(prev => ({ x: prev.x, y: newY }));
};
const handleContactMouseUp = () => {
const wasDragging = isDragging;
const moved = hasMovedRef.current;
setIsDragging(false);
if (!hasMovedRef.current && !wasDragging) {
setContactModalOpen(true);
}
hasMovedRef.current = false;
};
const handleContactClick = () => {
if (!hasMovedRef.current && !isDragging) {
if (!moved) {
setContactModalOpen(true);
}
};
@@ -1278,7 +1274,6 @@ const AppLayout: React.FC = () => {
</div>
<button
onClick={handleContactClick}
className={`contact-button ${isDragging ? 'dragging' : ''}`}
onMouseEnter={() => setContactHovered(true)}
onMouseLeave={() => setContactHovered(false)}