forked from UniAgent-Platform/bispace-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
219 lines (192 loc) · 7.59 KB
/
Copy pathindex.html
File metadata and controls
219 lines (192 loc) · 7.59 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Bi-Space Viewer</title>
<style>
:root {
--sidebar-w: 280px;
--sidebar-bg: rgba(255,255,255,0.92);
--sidebar-border: rgba(0,0,0,0.08);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Arial, sans-serif; }
/* Canvas covers full viewport; sits "under" the sidebar via z-index */
canvas { display: block; position: fixed; inset: 0; z-index: 0; }
/* Sidebar */
#sidebar {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: var(--sidebar-w);
z-index: 10; /* above canvas */
background: var(--sidebar-bg);
backdrop-filter: saturate(1.2) blur(2px);
border-right: 1px solid var(--sidebar-border);
box-shadow: 0 8px 24px rgba(0,0,0,0.08);
display: flex;
flex-direction: column;
padding: 12px;
gap: 12px;
overflow: auto; /* scroll if content grows */
pointer-events: auto; /* ensure it captures events */
}
#sidebar h2 {
font-size: 14px;
margin: 0 0 4px;
opacity: 0.7;
text-transform: uppercase;
letter-spacing: .08em;
}
.btn {
display: inline-block;
width: 100%;
padding: 8px 10px;
border-radius: 10px;
border: 1px solid var(--sidebar-border);
background: white;
cursor: pointer;
font-weight: 600;
}
.btn:active { transform: translateY(1px); }
.panel {
background: white;
border: 1px solid var(--sidebar-border);
border-radius: 12px;
padding: 10px;
}
.row {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 10px;
margin: 6px 0;
}
/* Optional: nudge canvas content right visually, without affecting raycasting */
body::before {
content: "";
position: fixed;
left: var(--sidebar-w);
top: 0;
bottom: 0;
width: 1px;
pointer-events: none;
z-index: 5;
background: linear-gradient(to bottom, rgba(0,0,0,0.06), rgba(0,0,0,0));
}
</style>
</head>
<body>
<!-- Sidebar UI (captures events so they don't reach the canvas) -->
<aside id="sidebar" aria-label="Controls">
<h2>XMI Upload<br/><small>(Offline)</small></h2>
<div class="panel">
<div class="row">
<label for="xmiMode">Mode</label>
<select id="xmiMode" style="width:145px;">
<option value="single">Single Root</option>
<option value="multi">Multi Root</option>
</select>
</div>
<div class="row">
<input type="file" id="xmiUpload" accept=".xmi" style="width:100%;" />
</div>
<button id="uploadXmiBtn" class="btn" style="margin-top:8px;">Upload & Render</button>
</div>
<h2>Samples<br/><small>(Offline)</small></h2>
<div class="panel">
<button id="fetchSampleModel_A" class="btn" data-stepsize="0.25">Home XRPALS 25cm</button>
<button id="fetchSampleModel_B" class="btn" data-stepsize="0.5">Home XRPALS 50cm</button>
<button id="fetchSampleModel_0" class="btn" data-stepsize="1.0">CF-Swarmwalker</button>
</div>
<h2><a href="https://github.com/UniAgent-CyberPhysicalAssets/cps.asset.crazyflie/tree/main/controller/cf.PyControl" target="_blank">cf.PyControl Connections</a><br/><small>(Real/Simulated)</small></h2>
<div class="panel">
<div class="row">
<label for="agentSlider">Websockets</label>
<span id="agentCountValue">1</span>
</div>
<input id="agentSlider" type="range" min="1" max="10" step="1" value="1" />
<div id="agentButtons"></div>
</div>
<h2>Grid<br/><small>(Bigrid-Provider-Service)</small></h2>
<div class="panel">
<div class="row">
<label for="rowsSlider">Rows</label>
<span id="rowsValue">5</span>
</div>
<input id="rowsSlider" type="range" min="1" max="20" step="1" value="5" />
<div class="row">
<label for="colsSlider">Cols</label>
<span id="colsValue">5</span>
</div>
<input id="colsSlider" type="range" min="1" max="20" step="1" value="5" />
<div class="row">
<label for="stepXSlider">Step X</label>
<span id="stepXValue">0.5</span>
</div>
<input id="stepXSlider" type="range" min="0.1" max="2" step="0.1" value="0.5" />
<div class="row">
<label for="stepYSlider">Step Y</label>
<span id="stepYValue">0.5</span>
</div>
<input id="stepYSlider" type="range" min="0.1" max="2" step="0.1" value="0.5" />
<div class="row">
<button id="fetchServiceAPI" class="btn" data-stepsize="0.25" style="margin-top:8px;">Call Service</button>
</div>
</div>
<h2>CDO Service</h2>
<div class="panel">
<div class="row">
<label for="cdoHost">Host:Port</label>
<input id="cdoHost" type="text" value="127.0.0.1:2036" style="width:140px;" />
</div>
<div class="row">
<label for="cdoRepo">Repository + Path</label>
<input id="cdoRepo" type="text" value="/repo1/system" style="width:140px;" />
</div>
<div class="row">
<label for="coordAsLinks">Coords as Links</label>
<input id="coordAsLinks" type="checkbox" />
</div>
<div class="row">
<button id="connectCDO" class="btn" style="margin-top:8px;">Connect to CDO</button>
</div>
</div>
</aside>
<!-- Application Module -->
<script type="module" src="src/main.js" defer></script>
<!-- Hard stop event propagation so nothing bubbles to canvas/OrbitControls -->
<script>
document.addEventListener('DOMContentLoaded', () => {
const sidebar = document.getElementById('sidebar');
if (!sidebar) return;
// Let sidebar controls do their thing, but don't let events leak to the canvas
const stopBubble = (e) => {
e.stopPropagation();
};
// If you *also* want to suppress the browser's context menu inside the sidebar, use this:
const stopBubbleAndPrevent = (e) => {
e.stopPropagation();
e.preventDefault();
};
// Events we want to contain to the sidebar (no leak to canvas)
// Use bubble phase (capture: false) so button/input handlers still run.
[
'click', 'dblclick',
'pointerdown', 'pointermove', 'pointerup',
'wheel',
'touchstart', 'touchmove', 'touchend',
'keydown', 'keyup'
].forEach(type => {
// Do NOT preventDefault on wheel/touch by default or you'll kill scrolling/gestures.
sidebar.addEventListener(type, stopBubble, { capture: false });
});
// Optional: suppress context menu in sidebar too (otherwise omit this)
sidebar.addEventListener('contextmenu', stopBubbleAndPrevent, { capture: false });
// sidebar.addEventListener('click', e => console.log('sidebar click', e.target), { capture: false });
});
</script>
</body>
</html>