From e7ddaee87230c873157057014e0474ffe85b3fe3 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 28 Apr 2026 19:28:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=8A=A8=E8=A7=86=E8=A7=92?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E5=8A=A0=E4=B8=8A=E8=A7=86=E8=A7=89=E5=8F=8D?= =?UTF-8?q?=E9=A6=88=EF=BC=88=E6=BB=91=E9=92=AE=E6=BB=91=E5=8A=A8+?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E5=8F=98=E5=8C=96=EF=BC=89=EF=BC=8C=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=94=B9=E4=B8=BA=E5=8F=AF=E7=82=B9=E5=87=BB=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/static/graph.html | 106 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 97 insertions(+), 9 deletions(-) diff --git a/ui/static/graph.html b/ui/static/graph.html index b419940..c7ee296 100644 --- a/ui/static/graph.html +++ b/ui/static/graph.html @@ -52,6 +52,73 @@ color: #ffffff; font-weight: bold; } + /* 开关切换 */ + .toggle-row { + margin-top: 8px; + display: flex; + align-items: center; + gap: 12px; + } + .toggle-row .label-text { + color: #8888aa; + font-size: 12px; + } + .toggle-switch { + position: relative; + width: 36px; + height: 20px; + cursor: pointer; + flex-shrink: 0; + } + .toggle-track { + position: absolute; + inset: 0; + background: rgba(60,60,80,0.8); + border-radius: 10px; + transition: all 0.3s; + border: 1px solid rgba(100,100,255,0.2); + } + .toggle-track.on { + background: rgba(68,136,255,0.5); + border-color: #4488ff; + } + .toggle-knob { + position: absolute; + width: 16px; + height: 16px; + left: 2px; + top: 2px; + background: #6666aa; + border-radius: 50%; + transition: all 0.3s; + } + .toggle-knob.on { + left: 18px; + background: #4488ff; + } + .toggle-btn { + display: flex; + align-items: center; + gap: 4px; + padding: 2px 8px; + border-radius: 4px; + border: 1px solid rgba(100,100,255,0.15); + background: transparent; + color: #8888aa; + font-size: 12px; + font-family: 'Courier New', monospace; + cursor: pointer; + transition: all 0.2s; + } + .toggle-btn:hover { + background: rgba(68,136,255,0.15); + color: #fff; + } + .toggle-btn.on { + background: rgba(68,136,255,0.3); + color: #4488ff; + border-color: #4488ff; + } #node-info { position: absolute; top: 20px; @@ -328,17 +395,17 @@

节点: 0

边: 0

状态: 初始化中...

-

+

- 自动视角 - - 活动 -

+ +

@@ -491,15 +558,36 @@ function init() { // 自动视角开关事件 var autoViewToggle = document.getElementById("autoViewToggle"); + var autoTrack = document.getElementById("autoTrack"); + var autoKnob = document.getElementById("autoKnob"); + var activityToggle = document.getElementById("activityToggle"); + + function updateAutoViewUI() { + if (autoViewToggle.checked) { + autoTrack.className = "toggle-track on"; + autoKnob.className = "toggle-knob on"; + } else { + autoTrack.className = "toggle-track"; + autoKnob.className = "toggle-knob"; + } + } + function updateActivityUI() { + activityToggle.classList.toggle("on"); + } + autoViewToggle.addEventListener("change", function() { autoViewEnabled = this.checked; + updateAutoViewUI(); }); - // 确保标签点击也能触发切换 document.getElementById("autoViewLabel").addEventListener("click", function(e) { - // 防止事件冒泡,直接切换 autoViewToggle.checked = !autoViewToggle.checked; autoViewToggle.dispatchEvent(new Event('change')); }); + activityToggle.addEventListener("click", function() { + updateActivityUI(); + // 活动切换逻辑(默认由后端处理) + this.blur(); + }); function createStarField() { const starCount = 3000;