-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
/
Copy pathresponsive-editor.html
85 lines (80 loc) · 1.93 KB
/
responsive-editor.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
<!-- Licensed under a BSD license. See license.html for license -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Three.js - Responsive Editor</title>
<style>
html, body {
height: 100%;
margin: 0;
font-size: 16pt;
}
#editor {
display: flex;
width: 100%;
height: 100%;
}
#controls {
background: #AAA;
padding: 5px;
}
#c {
width: 100%;
height: 100%;
display: block;
}
.gutter {
background-color: #eee;
background-repeat: no-repeat;
background-position: 50%;
}
.gutter.gutter-horizontal {
cursor: ew-resize;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==')
}
</style>
</head>
<body>
<div id="editor">
<div id="view"><canvas id="c"></canvas></div>
<div id="controls">
<div>
<p>various controls
would appear here</p>
<div>Drag this bar</div>
<div>⇐</div>
</div>
</div>
</div>
</body>
<script type="importmap">
{
"imports": {
"three": "../../build/three.module.js"
}
}
</script>
<script type="module" src="threejs-responsive.js"></script>
<script src="../3rdparty/split.min.js"></script>
<script type="module">
/* global Split */
// This code is only related to handling the split.
// Our three.js code has not changed
Split( [ '#view', '#controls' ], { // eslint-disable-line new-cap
sizes: [ 75, 25 ],
minSize: 100,
elementStyle: ( dimension, size, gutterSize ) => {
return {
'flex-basis': `calc(${size}% - ${gutterSize}px)`,
};
},
gutterStyle: ( dimension, gutterSize ) => {
return {
'flex-basis': `${gutterSize}px`,
};
},
} );
</script>
</html>