-
Notifications
You must be signed in to change notification settings - Fork 0
/
stlViewer.html
79 lines (62 loc) · 3.88 KB
/
stlViewer.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
<html>
<head>
<style>
a {text-decoration: underline}
</style>
<script type="text/javascript">
var stlViewer;
function loadContentAfterScriptsLoad(node) {
stlViewer = new StlViewer(node);
stlViewer.render();
};
function loadContent(node) {
/*
* this loadScripts() function call will load the javascript imports
* into this html file
*/
scriptloader.loadScripts('stlViewer', document, node.id, eventManager);
};
/*
* This is called when the student clicks on the save button below in the body
*/
function save() {
/*
* calls the save function in stlViewer.js
*/
stlViewer.save();
}
</script>
</head>
<body>
<!-- iframe id="hiddenSTLFileData" style="display: none; width: 100%; height: 200px;" -->
<!-- TODO create the html UI that the student will see when they visit the step -->
<!-- the promptDiv, responseDiv, saveButtonDiv are not required, they are only provided as an example,
you may delete all of these divs and create the body however you like -->
<div id='promptDiv'></div>
<div style="display: none" id='responseDiv'><textarea id='studentResponseTextArea' rows='8' cols='80'></textarea></div>
<div style="display: none" id='saveButtonDiv'><input type='button' value='Save' onclick='save()'></input></div>
<!-- the viewer div holds the 3-D representation of the STL file -->
<div id="viewer" style="width:400px;height:400px"></div>
<div id="instructions">Click on the button to choose an STL file on your computer to upload.</div>
<div id ="stlControls">
<input id="filePath" type="file" value="Browse" />
<input id="submit" type="button" value="Submit" onclick="stlViewer.uploadSTLFile();" />
<input onclick="thingiview.setCameraView('top');" type="button" value="Top" />
<input onclick="thingiview.setCameraView('side');" type="button" value="Side" />
<input onclick="thingiview.setCameraView('bottom');" type="button" value="Bottom" />
<input onclick="thingiview.setCameraView('diagonal');" type="button" value="Diagonal" />
<input onclick="thingiview.setCameraZoom(5);" type="button" value="Zoom +" />
<input onclick="thingiview.setCameraZoom(-5);" type="button" value="Zoom -" />
<div id="rotation">
Rotation: <input onclick="thingiview.setRotation(true);" type="button" value="on" /> | <input onclick="thingiview.setRotation(false);" type="button" value="off" />
</div>
<div id="wireframe">
<input onclick="thingiview.setObjectMaterial('wireframe');" type="button" value="Wireframe" />
<input onclick="thingiview.setObjectMaterial('solid');" type="button" value="Solid" />
</div>
Plane: <a onclick="thingiview.setShowPlane(false)">Hide</a> | <a onclick="thingiview.setShowPlane(true)">Show</a><br/>
Background Color: <a onclick="thingiview.setBackgroundColor('#606060')">Gray</a> | <a onclick="thingiview.setBackgroundColor('#ffffff')">White</a> | <a onclick="thingiview.setBackgroundColor('#000000')">Black</a><br/>
Object Color: <a onclick="thingiview.setObjectColor('#ffffff')">White</a> | <a onclick="thingiview.setObjectColor('#aa0000')">Red</a> | <a onclick="thingiview.setObjectColor('#CDFECD')">Green</a> | <a onclick="thingiview.setObjectColor('#C0D8F0')">Blue</a><br/>
</div>
</body>
</html>