-
Notifications
You must be signed in to change notification settings - Fork 293
/
Copy pathindex.html
514 lines (435 loc) · 16.9 KB
/
index.html
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>xeokit Examples</title>
<link href='https://fonts.googleapis.com/css?family=Exo+2:400,800,900,700,600,500|Roboto:100,300,400,500,700,900'
rel='stylesheet' type='text/css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js"></script>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 1rem;
line-height: 1.50;
color: #212529;
background-color: #000000;
text-decoration: none;
word-spacing: normal;
text-align: left;
letter-spacing: 0;
-webkit-font-smoothing: antialiased;
overflow-y: hidden;
overflow-x: hidden;
margin: 0;
width: 100%;
height: 100%;
}
#index {
position: absolute;
height: 100%;
background: #fdfdfd;
overflow: auto;
border-right: 2px solid #212529;
padding: 20px;
padding-bottom: 100px;
user-select: none;
}
#index a {
/*text-decoration: none;*/
}
#index h1 {
margin-top: 0;
margin-bottom: 0;
font-size: 1.8rem;
font-weight: normal;
text-decoration: none !important;
}
#index h1 a {
color: #212529;
}
#index h2 {
font-size: 1.4rem;
font-weight: normal;
padding-top: 20px;
padding-bottom: 10px;
text-decoration: none;
}
#index .link {
margin-left: 0 !important;
padding-left: 0 !important;
padding-top: 1px;
text-decoration: none;
font-weight: normal;
background: #fdfdfd;
cursor: pointer;
line-height: 1.5em;
}
#index .selected {
margin-left: -5px !important;
padding-left: 5px !important;
padding-top: 0;
padding-bottom: 0;
border: 1px solid #676767;
background: #FFFF44;
}
#index .commentFirst {
margin-left: 0 !important;
padding-left: 0 !important;
padding-top: 1px;
text-decoration: none;
font-weight: normal;
font-style: italic;
color: #8b8b8b;
cursor: pointer;
line-height: 1.5em;
margin-top: 10px;
margin-bottom: 10px;
}
#index .comment {
color: #8b8b8b;
margin-left: 0 !important;
padding-left: 0 !important;
padding-top: 1px;
text-decoration: none;
font-weight: normal;
font-style: italic;
cursor: pointer;
line-height: 1.5em;
margin-top: 10px;
margin-bottom: 10px;
}
#index .link:hover {
text-decoration: underline;
}
.content-container {
position: absolute;
z-index: 0;
padding: 0;
width: 100%;
height: 100%;
margin: 0 auto;
overflow: hidden;
opacity: 1.0;
pointer-events: all;
transition: all 300ms ease-in-out;
background: lightblue;
}
.content-overlay {
position: absolute;
z-index: 7;
padding: 0;
width: 100%;
height: 100%;
margin: 0 auto;
overflow: hidden;
opacity: 1.0;
pointer-events: none;
transition: all 300ms ease-in-out;
}
.slideout-sidebar {
position: fixed;
top: 0;
left: -600px;
z-index: 10;
width: 560px;
height: 100%;
padding: 0;
transition: all 300ms ease-in-out;
}
#index_toggle {
display: none;
}
#index_toggle:hover {
cursor: pointer;
}
.index-button {
position: absolute;
font-size: 18px;
top: 15px;
left: 20px;
text-align: center;
vertical-align: middle;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
z-index: 5;
transition: all 300ms ease-in-out;
}
.index-button:hover {
cursor: pointer;
color: black;
}
.page-title {
position: absolute;
font-size: 1.6rem;
top: 17px;
left: 75px;
text-align: left;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
z-index: 5;
transition: all 300ms ease-in-out;
max-width: calc(100% - 550px);
pointer-events: none;
}
.viewSourceButton {
position: absolute;
left: 20px;
bottom: 15px;
z-index: 200;
transition: all 300ms ease-in-out;
}
.viewSourceButton:hover {
cursor: pointer;
opacity: 1;
color: black;
}
#index_toggle:checked ~ .slideout-sidebar {
left: 0;
}
#index_toggle:checked + .index-button {
left: 585px;
color: white;
}
#index_toggle:checked ~ .page-title {
left: 530px;
color: white;
}
#index_toggle:checked ~ .viewSourceButton {
left: 570px;
}
#index_toggle:checked ~ .content-container {
opacity: 0.4;
pointer-events: none;
}
#index_toggle:checked ~ .content-overlay {
pointer-events: all;
}
</style>
</head>
<body>
<input type="checkbox" id="index_toggle"/>
<label for="index_toggle" class="index-button"><i class="fas fa-2x fa-bars"></i></label>
<div class="page-title" id="page-title"></div>
<div class="viewSourceButton" id="viewSourceButton"><i class="fas fa-2x fa-code"></i></div>
<div class="content-overlay" id="viewer-overlay"></div>
<iframe class="content-container" id="viewer" src="../default.html"></iframe>
<div class="slideout-sidebar">
<div id="index"><h1><a href="http://xeokit.io">xeokit</a> / <a href="../">Examples</a> / Measurement</h1></div>
</div>
</body>
<script>
const files = {
"Measuring Distances with Mouse": [
"# Creating distance measurements with mouse",
["distance_createWithMouse_snapping", "Click with mouse on model to create distance measurements, snapping enabled"],
["distance_createWithMouse_scenegraph", "Click with mouse on scene graph to create distance measurements, snapping disabled"],
["distance_createWithMouse_scenegraph_OBB", "Click with mouse on scene graph to create OBB aligned measurements, snapping disabled"],
["distance_createWithMouse_snapping_offsetCanvas", "Click with mouse on model to create distance measurements, snapping enabled, offset canvas"],
["distance_createWithMouse_snapping_Lyon", "Click with mouse on model to create distance measurements, snapping enabled"],
["distance_createWithMouse_labelsNotOnWires", "Click with mouse on model to create distance measurements, snapping enabled, labels one below the other"],
["distance_createWithMouse_useRotationAdjustment", "Click with mouse on model to create distance measurements, snapping enabled, rotation adjusted, labels one below the other"],
"# Creating distance measurements with mouse, snapping disabled",
["distance_createWithMouse_nosnapping", "Click with mouse on model to create distance measurements, snapping disabled"]
],
"Measuring Distances with Touch": [
"# Creating distance measurements with touch input",
["distance_createWithTouch_snapping", "Long-touch on model to create distance measurements"]
],
"Measuring Distances in JavaScript": [
"# Creating distance measurements programmatically",
["distance_modelWithMeasurements", "Creating distance measurements programmatically"],
["distance_modelWithMeasurements_hideAxisWires", "BIM model with distance measurements and axis-aligned wires hidden"],
["distance_modelWithMeasurements_useRotationAdjustment", "BIM model with distance measurements and rotation adjustment"],
["distance_unitsAndScale", "BIM model with configured units (see source code)"]
],
"Measuring Angles with Mouse": [
"# Creating angle measurements with mouse, snapping enabled",
["angle_createWithMouse_snapping", "Click with mouse on model to create angle measurements, snapping enabled"],
["angle_createWithMouse_snapping_offsetCanvas", "Click with mouse on model to create angle measurements, snapping enabled, offset canvas"],
"# Creating angle measurements with mouse, snapping disabled",
["angle_createWithMouse_nosnapping", "Click with mouse on model to create angle measurements, snapping disabled"]
],
"Measuring Angles with Touch": [
"# Creating distance measurements with touch input",
["angle_createWithTouch_snapping", "Long-touch on model to create angle measurements"]
],
"Measuring Angles in JavaScript": [
"# Creating angle measurements programmatically",
["angle_modelWithMeasurements", "Creating angle measurements programmatically"]
],
"Measuring Volumes": [
"# Measuring Volumes of Objects",
["volume_hoverToMeasure", "Hover over objects to measure their volumes"]
],
"Measuring Surface Areas": [
"# Measuring Surface Area of Objects",
["surfaceArea_hoverToMeasure", "Hover over objects to measure their surface areas"]
],
"Tests": [
"# Tests using programmatically created SceneModels",
["distance_createWithMouse_snapping_dtx_batching", "Click to measure distances, snapping enabled, data textures"],
["distance_createWithMouse_snapping_dtx_instancing", "Click to measure distances, snapping enabled, data textures"],
["distance_createWithMouse_snapping_vbo_batching", "Click to measure distances, snapping enabled, VBOs"],
["distance_createWithMouse_snapping_vbo_instancing", "Click to measure distances, snapping enabled, VBOs"]
]
};
const list = document.getElementById('index');
const viewer = document.getElementById('viewer');
const viewerOverlay = document.getElementById('viewer-overlay');
const container = document.createElement('div');
list.appendChild(container);
const viewSourceButton = document.getElementById('viewSourceButton');
viewSourceButton.addEventListener('click', function (event) {
window.open('https://github.com/xeokit/xeokit-sdk/blob/master/examples/measurement/' + selected + '.html');
}, false);
const indexToggle = document.getElementById("index_toggle");
const pageTitle = document.getElementById('page-title');
viewerOverlay.addEventListener('click', function (event) {
indexToggle.checked = false;
}, false);
// indexToggle.addEventListener('click', function (event) {
// viewer.src="default.html";
// }, false);
const sectionDivs = {};
const divs = {};
const fileDescriptions = {};
let selected = null;
let index = 1;
var indexStr;
// Index
let div = document.createElement('h2');
div.textContent = "Index";
container.appendChild(div);
container.appendChild(document.createElement('hr'));
const sectionNames = Object.keys(files);
// sectionNames.sort((a, b) => {
// if (a < b) {
// return -1;
// }
// if (a > b) {
// return 1;
// }
// return 0;
// });
for (let i = 0, len = sectionNames.length; i < len; i++) {
const sectionName = sectionNames[i];
const sectionFiles = files[sectionName];
var sectionDiv = document.createElement('div');
sectionDiv.className = 'link';
indexStr = "" + index++ + ".";
for (let i = indexStr.length, len = 5; i < len; i++) {
indexStr += ".";
}
sectionDiv.textContent = indexStr + sectionName;
sectionDiv.addEventListener('click', (function () {
const _sectionName = sectionName;
return function () {
sectionDivs[_sectionName].scrollIntoView();
}
})());
container.appendChild(sectionDiv);
}
container.appendChild(document.createElement('hr'));
_index = 1;
let clickedFile = null;
for (let i = 0, len = sectionNames.length; i < len; i++) {
const sectionName = sectionNames[i];
const sectionFiles = files[sectionName];
const sectionDiv = document.createElement('h2');
sectionDiv.textContent = _index++ + ". " + sectionName;
container.appendChild(sectionDiv);
sectionDivs[sectionName] = sectionDiv;
container.appendChild(document.createElement('hr'));
for (let i = 0; i < sectionFiles.length; i++) {
let sectionFile = sectionFiles[i];
let fileName;
let fileDesc;
if (!isString(sectionFile)) {
fileName = sectionFile[0];
fileDesc = sectionFile[1];
} else {
fileName = sectionFile;
fileDesc = sectionFile;
}
if (fileDesc.charAt(0) === "#") {
const commentDiv = document.createElement('div');
commentDiv.textContent = "// " + fileDesc.substring(1);
commentDiv.className = (i === 0 ? 'commentFirst' : 'comment');
container.appendChild(commentDiv);
continue;
}
const fileNameComponents = fileName.split('_');
// fileNameComponents.shift();
const fileNamePath = fileNameComponents.join(' / ');
const fileNameDiv = document.createElement('div');
fileNameDiv.className = 'link';
fileNameDiv.textContent = fileNamePath; // expandCamel(name);
fileNameDiv.addEventListener('click', (function () {
const _file = fileName;
return function () {
clickedFile = _file;
window.location.hash = "#" + _file;
viewer.src = "";
}
})());
container.appendChild(fileNameDiv);
divs[fileName] = fileNameDiv;
fileDescriptions[fileName] = fileDesc;
}
}
const paddingDiv = document.createElement('div');
paddingDiv.style["height"] = "50px";
container.appendChild(paddingDiv);
function expandCamel(str) {
return str.replace(/([A-Z])/g, function ($1) {
return " " + $1.toLowerCase();
});
}
if (window.location.hash !== '') {
load(window.location.hash.substring(1));
} else {
indexToggle.checked = true;
}
var hash = window.location.hash;
window.setInterval(function () {
if (window.location.hash !== hash || viewer.src === "") {
setTimeout(() => {
load(window.location.hash.substring(1));
hash = window.location.hash;
}, 300)
indexToggle.checked = false;
}
}, 70);
function scrollIntoView(div) {
document.getElementById("index").scrollTop = documentOffsetTop(div) - (window.innerHeight / 6);
}
function documentOffsetTop(div) {
return div.offsetTop + (div.offsetParent ? documentOffsetTop(div.offsetParent) : 0);
}
function load(file) {
pageTitle.innerText = fileDescriptions[file] || "Example not found - perhaps renamed?";
if (file.indexOf(".html", file.length - 5) !== -1) {
window.location = "./" + file + ".html";
return;
}
if (selected !== null) divs[selected].className = 'link';
divs[file].className = 'link selected';
window.location.hash = file;
viewer.src = file + '.html';
viewer.focus();
viewSourceButton.style.display = '';
selected = file;
if (clickedFile !== file) {
scrollIntoView(divs[file]);
}
clickedFile = null;
}
function isString(value) {
return (typeof value === 'string' || value instanceof String);
}
</script>
</html>