-
Notifications
You must be signed in to change notification settings - Fork 32
/
sample_instructions.htm
171 lines (166 loc) · 7.15 KB
/
sample_instructions.htm
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
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<title>Sample Building Instructions</title>
<link href="css/instructions.css" rel="stylesheet" type="text/css" />
<link href="css/preview.css" rel="stylesheet" type="text/css" />
<link href="css/buttons.css" rel="stylesheet" type="text/css" />
<link href="css/options.css" rel="stylesheet" type="text/css" />
<meta name="viewport" content="width=device-width" />
</head>
<body onLoad="main()">
<script src="js/jquery.min.js"></script>
<script src="js/three.min.js"></script>
<script src="js/OrbitControls.js"></script>
<script src="js/CopyShader.js"></script>
<script src="js/Pass.js"></script>
<script src="js/OutlinePass.js"></script>
<script src="js/ShaderPass.js"></script>
<script src="js/FXAAShader.js"></script>
<script src="js/RenderPass.js"></script>
<script src="js/MaskPass.js"></script>
<script src="js/EffectComposer.js"></script>
<script src="js/colors.js"></script>
<script src="js/LDRShaders.js"></script>
<script src="js/LDRColorMaterials.js"></script>
<script src="js/pli.js"></script>
<script src="js/LDRSVG.js"></script>
<script src="js/LDROptions.js"></script>
<script src="js/ClientStorage.js"></script>
<script src="js/LDRGeometries.js"></script>
<script src="js/LDRLoader.js"></script>
<script src="js/LDRStepHandler.js"></script>
<script src="js/RectanglePacking.js"></script>
<script src="js/LDRPLIBuilder.js"></script>
<script src="js/LDRPLIPreview.js"></script>
<script src="js/LDRButtons.js"></script>
<script src="js/LDRMeasurer.js"></script>
<script src="js/LDRColorPicker.js"></script>
<script src="js/LDRStepEditor.js"></script>
<script src="js/LDRGenerator.js"></script>
<script src="js/LDRStuds.js"></script>
<script src="js/LDRAssemblies.js"></script>
<script src="js/LDRInstructionsManager.js"></script>
<script src="js/LDCadGenerator.js"></script>
<div id="main_canvas_holder">
<canvas id="main_canvas"></canvas>
<div id="instructions_decorations">
<span id="empty_step">EMPTY STEP</span>
<canvas id="pli"></canvas>
<div id="pli_drag_horizontal">
<div id="pli_icon_right"><svg viewbox="-10,-10,20,20">
<path d="M 9 6, 9 9, -9 9, -9 -9, 9 -9, 9 -6" />
<line x1="0" y1="0" x2="9" y2="0" />
<line x1="9" y1="0" x2="5" y2="5" />
<line x1="9" y1="0" x2="5" y2="-5" />
</svg></div>
<div id="pli_icon_left"><svg viewbox="-10,-10,20,20">
<path d="M -9 6, -9 9, 9 9, 9 -9, -9 -9, -9 -6" />
<line x1="0" y1="0" x2="-9" y2="0" />
<line x1="-9" y1="0" x2="-5" y2="5" />
<line x1="-9" y1="0" x2="-5" y2="-5" />
</svg></div>
</div>
<div id="pli_drag_vertical">
<div id="pli_icon_down"><svg viewbox="-10,-10,20,20">
<path d="M 6 9, 9 9, 9 -9, -9 -9, -9 9, -6 9" />
<line x1="0" y1="0" x2="0" y2="9" />
<line x1="0" y1="9" x2="5" y2="5" />
<line x1="0" y1="9" x2="-5" y2="5" />
</svg></div>
<div id="pli_icon_up"><svg viewbox="-10,-10,20,20">
<path d="M 6 -9, 9 -9, 9 9, -9 9, -9 -9, -6 -9" />
<line x1="0" y1="0" x2="0" y2="-9" />
<line x1="0" y1="-9" x2="5" y2="-5" />
<line x1="0" y1="-9" x2="-5" y2="-5" />
</svg></div>
</div>
<span class="decoration_holder">
<div id="multiplier">x1</div>
</span>
<span class="decoration_holder">
<div id="rotator">
<svg viewbox="-52,-52,104,104" fill="none" stroke="black" stroke-width="12">
<g id="full_arrow">
<path id="half_arrow" d="M 25,-14 40,-10 48,-23 M 40,-10 C 30,-50 -30,-50 -40,-10 M 40,-10 Z" />
<g transform="scale(-1 -1)">
<use xlink:href="#half_arrow"/>
</g>
</g>
<animateTransform
xlink:href="#full_arrow"
attributeName="transform"
attributeType="XML"
id="rotator_animation"
type="rotate"
from="0 0 0"
to="180 0 0"
dur="0.4s"
begin="0"
repeatCount="1"
fill="freeze" />
</svg>
</div>
</span>
</div>
</div>
<div id="pli_preview_section">
<div id="preview_background" class="background" onclick="manager.hidePliPreview();"></div>
<div id="preview_holder" class="holder">
<div id="preview_parent"><canvas id="secondary_canvas"></canvas></div>
<div id="preview_info">
<span class="preview_info_line">
<span id="preview_info_name">PART NAME</span>
<a id="preview_info_bh_link" href="" target="_blank">Go to part</a>
or
<a id="preview_info_bl_link" href="" target="_blank">See on BrickLink</a>
</span>
<span class="preview_info_line">LDraw color: <div id="preview_info_color_ldraw">LDR COLOR</div></span>
<span class="preview_info_line">LEGO/LDD color: <div id="preview_info_color_lego">LDD COLOR</div></span>
<span class="preview_info_line">Bricklink: <div id="preview_info_id_bricklink">ID</div> in color <div id="preview_info_color_bricklink">COLOR</div></span>
</div>
</div>
</div>
<div id="done_section">
<div id="done_background" onclick="manager.hideDone();"></div>
<div id="done_holder" class="holder"></div>
</div>
<div id="color_picker">
<div id="color_picker_background" class="background" onclick="$('#color_picker').hide();"></div>
<div id="color_picker_holder" class="holder"></div>
</div>
<div id="green">
<div id="editor"></div>
</div>
<div id="options" /></div>
<script>
var model = 'models/corvette_full.mpd';
//var model = 'models/test_purging.mpd';
//var model = 'models/spiral.ldr';
const baseURL = 'sample_instructions.htm?step='; // Change this line so it fits the page that renders instructions for you (probably not 'sample_instructions.htm')
var manager;
function main() {
let options = {
canEdit: false, // Show editor options
buildAssemblies: true, // Assemble parts, such as minifig torsos and legs
key: model,
adPeek: 0, // Show a bar below to contain editor options - set to roughly 120 if canEdit is set to true
setUpOptions: true, // Show button options below.
showNumberOfSteps: true,
pliMaxWidthPercentage: 30, // The maximum width of the PLI box in percentage of the screen width when the PLI box is shown on the left side.
pliMaxHeightPercentage: 30, // The maximum height of the PLI box in percentage of the screen height when the PLI box is shown on top.
timestamp: '1970-01-01 00:00:00', // Ensure that model can be retrieved from InstancedDB
cleanUpPrimitivesAndSubParts: true
};
// Get the requested step from the query parameters:
let step = 1;
let stepFromUrl = location.search.substr(1).split('&').map(x => x.split('=')).find(x => x[0] === 'step');
if(stepFromUrl) {
step = stepFromUrl[1];
}
manager = new LDR.InstructionsManager(model, '#', 14, null, ()=>{}, baseURL, step, options);
};
</script>
</body>
</html>