]> acesimba.cloud Git - StationBuilder.git/commitdiff
fix: 修复 AI 悬浮按钮拖动时常失效的问题
authorwang.yu <wang.yu@advantech.com>
Tue, 18 Aug 2026 01:08:18 +0000 (09:08 +0800)
committerwang.yu <wang.yu@advantech.com>
Tue, 18 Aug 2026 01:08:18 +0000 (09:08 +0800)
图标改为不可原生拖拽(draggable=false)并让事件直接落在按钮上(pointer-events:none),
避免浏览器图片拖拽劫持 Pointer 拖拽手势;按下拖动时移除 1px 移位。

app/globals.css
app/page.tsx
public/design-doc.html

index 509b512cbddeb4c22deb3c4210484f2692ef89c6..49e8d15819d6d4dafb471d8601d3179d549f8df9 100644 (file)
@@ -27,9 +27,9 @@
 @media(max-width:1100px){.app-shell{padding-left:42px}.side-nav{display:none}.workspace{min-width:900px}.sticky-actions{left:42px}.top-actions small{display:none}.result-layout{grid-template-columns:1fr}.preview-main{grid-template-columns:1fr 260px}.mu-grid{grid-template-columns:repeat(2,1fr)}}
 
 /* 右下角浮动 AI 会话 */
-.ai-fab{position:fixed;right:22px;bottom:22px;z-index:80;width:54px;height:54px;border-radius:50%;border:0;background:transparent;box-shadow:0 8px 22px #0a85c355;display:grid;place-items:center;cursor:pointer;touch-action:none;user-select:none}.ai-fab-icon{width:54px;height:54px;border-radius:50%;object-fit:cover}
+.ai-fab{position:fixed;right:22px;bottom:22px;z-index:80;width:54px;height:54px;border-radius:50%;border:0;background:transparent;box-shadow:0 8px 22px #0a85c355;display:grid;place-items:center;cursor:pointer;touch-action:none;user-select:none}.ai-fab-icon{width:54px;height:54px;border-radius:50%;object-fit:cover;-webkit-user-drag:none;user-drag:none;user-select:none;pointer-events:none}
 .ai-fab:active{cursor:grabbing}
-.ai-fab:hover{transform:translateY(-1px);box-shadow:0 12px 26px #0a85c366}
+.ai-fab:hover:not(:active){transform:translateY(-1px);box-shadow:0 12px 26px #0a85c366}
 .ai-dialog{position:fixed;right:22px;bottom:88px;z-index:81;width:25vw;min-width:320px;height:70vh;min-height:420px;background:#fff;border:1px solid #d2d6d9;border-radius:10px;box-shadow:0 18px 48px #0003;display:flex;flex-direction:column;overflow:hidden}
 .ai-dialog header{display:flex;align-items:center;gap:9px;padding:10px 12px;border-bottom:1px solid #eceef0;background:linear-gradient(135deg,#6d5ee9,#0aa5e8);color:#fff}
 .ai-dialog .ai-dialog-logo{width:28px;height:28px;border-radius:7px;background:#ffffff33;display:grid;place-items:center;font-size:15px}
index bbad49ec5b97e92e3a844c66f5e233865450cfaf..407b109767e30375db85ef3aa7318203354747a0 100644 (file)
@@ -442,7 +442,7 @@ export default function Home(){
     {!aiOpen&&<button ref={fabRef} className="ai-fab" title="AI 助手 · 拖动可移动位置,双击复位" aria-label="AI 助手"
       style={fabPos?{left:fabPos.x,top:fabPos.y,right:"auto",bottom:"auto"}:undefined}
       onPointerDown={onFabPointerDown} onPointerMove={onFabPointerMove} onPointerUp={onFabPointerUp} onDoubleClick={resetFab}>
-      <img src="/ai-icon.png" alt="AI 助手" className="ai-fab-icon" />
+      <img src="/ai-icon.png" alt="AI 助手" className="ai-fab-icon" draggable={false} />
     </button>}
     {aiOpen&&<div className="ai-dialog">
       <header><span className="ai-dialog-logo">✦</span><div className="ai-dialog-title"><b>StationBuilder AI</b><small>模型 · {model}</small></div><button className="ai-close" onClick={()=>setAiOpen(false)}>×</button></header>
index d8a5c0c77e9029ede795b5f8dc11ca7324b1ddb2..b899343814591ec5b220f106b3a2ce1105227be4 100644 (file)
@@ -73,7 +73,7 @@
   <nav class="doc-nav"><div class="doc-nav-inner" id="toc"></div></nav>
 
 <main id="doc">
-  <p class="muted">文档版本:v0.3 最后更新:2026-08-17 状态:开发中(演示数据已标注)</p>
+  <p class="muted">文档版本:v0.3 最后更新:2026-08-18 状态:开发中(演示数据已标注)</p>
   <h1>StationBuilder 产品与交互设计方案</h1>
 
   <h2>1. 文档说明</h2>
   </ul>
 
   <h2>11. 维护与导出说明</h2>
+
+  <h3>11.1 更新记录</h3>
+  <ul>
+    <li>2026-08-18 修复右下角 AI 悬浮按钮拖动时常失效的问题:图标改为不可原生拖拽、事件直接落在按钮上,避免浏览器图片拖拽劫持 Pointer 拖拽手势;按下拖动时不再有 1px 移位。</li>
+  </ul>
+
   <ul>
     <li>功能变更后请同步更新本文档对应章节,未实现项持续标注 <span class="todo">尚未实现</span>,落地后移除。</li>
     <li><b>下载 PDF</b>:调用浏览器打印,请在打印对话框选择「另存为 PDF」。</li>