-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
221 lines (202 loc) · 9.52 KB
/
index.html
File metadata and controls
221 lines (202 loc) · 9.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RoadNet Visualizer - 多层道路网络可视化</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/src/css/tailwind.css" />
<link rel="stylesheet" href="/src/css/index.css" />
<style>
.github-link {
position: fixed;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
align-items: center;
gap: 10px;
padding: 10px 18px;
border-radius: 12px;
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(24px);
-webkit-backdrop-filter: blur(24px);
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
color: rgba(255, 255, 255, 0.56);
text-decoration: none;
transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
z-index: 1000;
font-weight: 600;
font-size: 13px;
}
.github-link:hover {
background: rgba(255, 255, 255, 0.08);
border-color: rgba(94, 106, 210, 0.3);
color: rgba(255, 255, 255, 0.92);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(94, 106, 210, 0.1);
transform: translateX(-50%) translateY(-1px);
}
.github-link svg {
width: 18px;
height: 18px;
fill: currentColor;
display: block;
}
/* 桌面端侧边栏 Tab 样式 - Linear Dark */
.sidebar-tab {
background: transparent;
color: rgba(255, 255, 255, 0.56);
cursor: pointer;
transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar-tab:hover {
background: rgba(94, 106, 210, 0.08);
color: rgba(255, 255, 255, 0.92);
}
.sidebar-tab.active {
background: var(--primary-color, #5E6AD2);
color: var(--text-white, #fff);
border-color: transparent;
box-shadow: 0 2px 12px rgba(94, 106, 210, 0.25);
}
</style>
</head>
<body
class="bg-[var(--bg-page)] text-[var(--text-primary)] selection:bg-[var(--primary-color)] selection:text-[var(--text-white)]">
<div
class="rn-container flex flex-col lg:grid grid-cols-1 lg:grid-cols-[340px_minmax(0,1fr)] gap-4 lg:gap-6 p-3 lg:p-6 h-[100dvh] lg:h-screen overflow-hidden items-stretch">
<!-- 统一侧边栏:包含导航 + 面板(PC 为左侧栏,移动端为全屏切换) -->
<div id="sidebar" class="flex flex-col min-h-0">
<!-- 统一导航栏(PC/移动端共用) -->
<nav id="main-tabs" aria-label="主模块切换" role="tablist"
class="sticky top-0 z-50 mb-2 lg:mb-4 flex items-center gap-2 p-2 rounded-xl glass-panel border border-[var(--border-light)] shadow-[var(--shadow-sm)]">
<a href="https://github.com/Duri686/RoadNetVisualizer" target="_blank" rel="noopener noreferrer"
class="flex items-center justify-center w-8 h-8 rounded-lg text-[var(--text-primary)] hover:bg-[rgba(94,106,210,0.08)] transition-all"
aria-label="View on GitHub">
<svg class="w-5 h-5 lg:w-4 lg:h-4" viewBox="0 0 16 16" fill="currentColor">
<path
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.54 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z" />
</svg>
</a>
<span class="w-px h-6 bg-[var(--border-light)]"></span>
<!-- 地图 Tab:仅移动端可见 -->
<button type="button" data-panel="map"
class="sidebar-tab active lg:hidden flex-1 text-center px-3 py-2 text-sm font-medium rounded-lg border border-transparent transition-all">
地图
</button>
<button type="button" data-panel="operation"
class="sidebar-tab flex-1 text-center px-3 py-2 text-sm font-medium rounded-lg border border-transparent transition-all">
操作
</button>
<button type="button" data-panel="interpretation"
class="sidebar-tab flex-1 text-center px-3 py-2 text-sm font-medium rounded-lg border border-transparent transition-all">
解读
</button>
</nav>
<!-- 面板内容区(单实例,PC/移动端共享) -->
<div id="sidebar-panels" class="flex-1 overflow-y-auto pt-1 scrollbar-none hidden lg:block">
<div id="panel-operation" class="sidebar-panel">
<rn-operation-panel></rn-operation-panel>
</div>
<div id="panel-interpretation" class="sidebar-panel hidden">
<rn-interpretation-panel></rn-interpretation-panel>
</div>
</div>
</div>
<!-- 可视化面板(PC 常驻;移动端地图 Tab 激活时显示) -->
<section id="canvas-section"
class="flex flex-col min-w-0 min-h-0 overflow-hidden flex-1 lg:h-full">
<rn-visualization-panel class="flex flex-col flex-1 min-h-0"></rn-visualization-panel>
</section>
<script>
// 统一 Tab 切换逻辑(PC/移动端共用)
document.addEventListener('DOMContentLoaded', () => {
const tabs = document.querySelectorAll('#main-tabs .sidebar-tab');
const sidebarPanels = document.getElementById('sidebar-panels');
const canvasSection = document.getElementById('canvas-section');
const panels = document.querySelectorAll('#sidebar-panels .sidebar-panel');
const isDesktop = () => window.matchMedia('(min-width: 1024px)').matches;
function switchTab(panelName) {
// 更新 Tab 激活状态
tabs.forEach(t => t.classList.remove('active'));
const activeBtn = document.querySelector(`#main-tabs [data-panel="${panelName}"]`);
if (activeBtn) activeBtn.classList.add('active');
if (isDesktop()) {
// PC:canvas 始终可见,切换侧边栏面板
const target = panelName === 'map' ? 'operation' : panelName;
sidebarPanels.classList.remove('hidden');
sidebarPanels.style.display = '';
canvasSection.classList.remove('hidden');
canvasSection.style.display = '';
panels.forEach(p => p.classList.add('hidden'));
document.getElementById('panel-' + target)?.classList.remove('hidden');
} else {
// 移动端:地图显示 canvas,操作/解读显示侧边栏面板
// 先统一清除内联样式,避免 inline style 覆盖 class
sidebarPanels.style.display = '';
sidebarPanels.style.flexDirection = '';
canvasSection.style.display = '';
if (panelName === 'map') {
sidebarPanels.classList.add('hidden');
canvasSection.classList.remove('hidden');
// canvas 从 hidden 恢复后需要触发 Three.js resize
requestAnimationFrame(() => {
window.dispatchEvent(new Event('resize'));
});
} else {
canvasSection.classList.add('hidden');
sidebarPanels.classList.remove('hidden');
sidebarPanels.style.display = 'flex';
sidebarPanels.style.flexDirection = 'column';
panels.forEach(p => p.classList.add('hidden'));
document.getElementById('panel-' + panelName)?.classList.remove('hidden');
}
}
}
tabs.forEach(tab => {
tab.addEventListener('click', () => switchTab(tab.dataset.panel));
});
// 响应式切换:屏幕尺寸变化时自动适配
const mq = window.matchMedia('(min-width: 1024px)');
mq.addEventListener('change', () => {
// 清除所有内联样式
sidebarPanels.style.display = '';
sidebarPanels.style.flexDirection = '';
canvasSection.style.display = '';
if (isDesktop()) {
// 切到 PC:恢复双栏布局
sidebarPanels.classList.remove('hidden');
canvasSection.classList.remove('hidden');
// 激活当前面板 Tab(排除 map)
const activeTab = document.querySelector('#main-tabs .sidebar-tab.active');
const current = activeTab?.dataset.panel;
switchTab(current === 'map' ? 'operation' : (current || 'operation'));
} else {
// 切到移动端:默认显示地图
switchTab('map');
}
});
// 初始状态
if (isDesktop()) {
switchTab('operation');
} else {
switchTab('map');
}
// 鼠标追踪光效 - spotlight cards
document.addEventListener('mousemove', (e) => {
document.querySelectorAll('.spotlight-card').forEach(card => {
const rect = card.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
card.style.setProperty('--mouse-x', x + 'px');
card.style.setProperty('--mouse-y', y + 'px');
});
}, { passive: true });
});
</script>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>