forked from modelo/API_samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
382 lines (318 loc) · 11.4 KB
/
index.html
File metadata and controls
382 lines (318 loc) · 11.4 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<title>M.Build API Samples</title>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="icon" type="image/png" href="./modelo.png" sizes="16x16" />
<style>
@font-face {
font-family: 'inconsolata';
src: url('assets/fonts/inconsolata.woff') format('woff');
font-weight: normal;
font-style: normal;
}
* {
box-sizing: border-box;
}
html {
height: 100%;
}
body {
background-color: #ffffff;
margin: 0px;
height: 100%;
color: #555;
font-family: 'inconsolata';
font-size: 15px;
line-height: 18px;
overflow: hidden;
}
h1 {
margin-top: 30px;
margin-bottom: 10px;
margin-left: 20px;
font-size: 25px;
font-weight: normal;
}
h2 {
font-size: 20px;
font-weight: normal;
}
a {
color: #2194CE;
text-decoration: none;
}
#githubLink {
margin-left: 20px;
margin-bottom: 30px;
}
#panel {
position: fixed;
left: 0px;
width: 310px;
height: 100%;
overflow: auto;
background: #fafafa;
}
#panel #content {
padding: 0px 20px;
}
#panel #content .link {
color: #2194CE;
text-decoration: none;
cursor: pointer;
}
#panel #content .selected {
color: #ff0000;
}
#panel #content .link:hover {
text-decoration: underline;
}
#viewer {
position: absolute;
border: 0px;
left: 310px;
width: calc(100% - 310px);
height: 100%;
overflow: auto;
}
#button {
position: fixed;
bottom: 20px;
right: 20px;
padding: 8px;
color: #fff;
background-color: #555;
opacity: 0.7;
}
#button:hover {
cursor: pointer;
opacity: 1;
}
/* mobile */
#expandButton {
display: none;
position: absolute;
right: 20px;
top: 12px;
width: 32px;
height: 32px;
}
#expandButton span {
height: 2px;
background-color: #2194CE;
width: 16px;
position: absolute;
left: 8px;
top: 10px;
}
#expandButton span:nth-child(1) {
top: 16px;
}
#expandButton span:nth-child(2) {
top: 22px;
}
@media all and ( max-width: 640px ) {
h1{
margin-top: 20px;
margin-bottom: 20px;
}
#panel{
position: absolute;
left: 0;
top: 0;
height: 480px;
width: 100%;
right: 0;
z-index: 100;
overflow: hidden;
border-bottom: 1px solid #dedede;
}
#content{
position: absolute;
left: 0;
top: 60px;
right: 0;
bottom: 0;
font-size: 17px;
line-height: 22px;
overflow: auto;
}
#viewer{
position: absolute;
left: 0;
top: 56px;
width: 100%;
height: calc(100% - 56px);
}
#expandButton{
display: block;
}
#panel.collapsed{
height: 56px;
}
}
</style>
</head>
<body>
<div id="panel" class="collapsed">
<h1>M.Build API Samples</h1>
<div id="githubLink">(<a href="https://github.com/modelo/API_samples">GitHub repo</a>)</div>
<a id="expandButton" href="#">
<span></span>
<span></span>
<span></span>
</a>
<div id="content"></div>
</div>
<iframe id="viewer" allowfullscreen></iframe>
<script>
var files = {
"城市地图|City-Maps": [
"北京|beijing",
"上海|shanghai",
"广州|guangzhou",
"深圳|shenzhen",
"杭州|hangzhou"
],
"视窗|View": [
//"local-model",
"模型视窗|model-viewer",
"模型对比视窗|model-compare-viewer",
"360全景图视窗|360-image-viewer",
"360全景图跳转|360-multiple-images",
'暗色模式|darktheme',
'模型对比用户界面|model-compare-ui',
"默认用户界面|default-ui",
'DWG文件浏览界面|dwg-ui',
"手绘板界面|sketch-ui",
],
"场景|Scene": [
"目标替换|pawn",
"立体文字|text3D",
"环境背景|background",
"截屏|dump-screen",
"全局ID|guid",
"相机控制|camera-manipulation",
"设置构件颜色和可见|set-elements-color-and-visibility",
"改变构件材质|change-elements-material",
"切换相机透视模式|switch-camera-type",
"html标签定位|html-labels",
"二三维联动|2D-3D"
],
"渲染特效|Rendering Effects": [
"光照|lighting",
"模型炸开|explode-view",
"边线效果|sketch",
"物体发光|glow",
"高亮边缘|highlight",
"景深效果|depth-of-field"
],
"工具|Tools": [
"剖面|section",
"放大镜|magnify-glass",
"量尺|ruler",
"相机漫游|camera-navigator"
],
"模型|Model": [
"编辑模型|manipulate-model",
"上传模型|upload-model",
"合并模型|merge-models",
"备注卡片|comments",
"三维PDF|3d-pdf"
],
"建筑信息模型|BIM": [
"BIM信息树|bim-tree",
"构件信息|element-data"
],
"可视化|Visualization": [
"动态流线|animating-ribbon",
"气体渲染|volume-rendering",
"空间热力图|multi-layer-volume",
"三维柱状图|bar-chart",
"高程热力图|height-map",
"二维变形球|metaball",
"轨迹|trail",
"行走动画|walking-animation"
],
"整合|Integration": [
"jquery"
],
"演示案例|Test Case": [
"二维图表联动|2d-graph-interaction",
'楼宇空间热力图|building-spacial-heatmap'
]
};
var panel = document.getElementById( 'panel' );
var content = document.getElementById( 'content' );
var viewer = document.getElementById( 'viewer' );
var expandButton = document.getElementById( 'expandButton' );
expandButton.addEventListener( 'click', function ( event ) {
panel.classList.toggle( 'collapsed' );
event.preventDefault();
} );
// iOS8 workaround
if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
viewer.addEventListener( 'load', function ( event ) {
viewer.contentWindow.innerWidth -= 10;
viewer.contentWindow.innerHeight -= 2;
} );
}
var container = document.createElement( 'div' );
content.appendChild( container );
var button = document.createElement( 'div' );
button.id = 'button';
button.textContent = 'View source';
button.addEventListener( 'click', function ( event ) {
var array = location.href.split( '/' );
array.pop();
var sampleDoc = viewer.contentDocument || viewer.contentWindow.document;
var highlightedLines = sampleDoc.getElementById('highlightedLines') || '';
var lines = !!highlightedLines ? highlightedLines.innerHTML : '';
window.open( 'https://github.com/modelo/API_samples/blob/master/samples/' + selected.slice(selected.indexOf("|")+1) + '/index.js' + lines );
}, false );
button.style.display = 'none';
document.body.appendChild( button );
var divs = {};
var selected = null;
for ( var key in files ) {
var section = files[ key ];
var div = document.createElement( 'h2' );
div.textContent = key;
container.appendChild( div );
for ( var i = 0; i < section.length; i ++ ) {
/*jshint loopfunc: true */
( function ( file ) {
var div = document.createElement( 'div' );
div.className = 'link';
div.textContent = file;
div.addEventListener( 'click', function () {
panel.classList.toggle( 'collapsed' );
load( file );
} );
container.appendChild( div );
divs[ file ] = div;
} )( section[ i ] );
}
}
var load = function ( file, suffix ) {
var suffix = suffix || "";
if ( selected !== null ) divs[ selected ].className = 'link';
divs[ file ].className = 'link selected';
window.location.hash = file;
viewer.src = 'samples/' + file.slice(file.indexOf("|")+1) + '/index.html' + '?' + suffix;
viewer.focus();
button.style.display = '';
selected = file;
};
if ( window.location.hash !== '' ) {
load( decodeURI(window.location.hash).substring( 1 ) );
}
</script>
</body>
</html>