-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
291 lines (230 loc) · 9.2 KB
/
Copy pathindex.html
File metadata and controls
291 lines (230 loc) · 9.2 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
<!doctype html>
<html lang="en" data-colourscheme="dark">
<head>
<title>Turtle v0.14.0 by ldpercy</title>
<meta charset="utf-8">
<meta name="description" content="Turtle v0.14.0 by ldpercy - HTML, CSS, SVG, JavaScript">
<meta name="color-scheme" content="dark light">
<meta name="theme-color" content="lightseagreen"/>
<link rel="icon" href="./favicon.svg"/>
<link rel="stylesheet" href="./index.css"/>
<script type="module" src="./index.js"></script>
</head>
<body>
<div class="panel-group group-left">
<form id="form-turtle" tabindex="0" class="ui-panel">
<h1>Turtle</h1>
<h3>Commands</h3>
<section>
<textarea id="input-command" class="tab-body" type="string" name="command" title="Current command set" spellcheck="false">right 60,500</textarea>
<nav id="command-tabs" class="tabbar bottom">
<a href="#commandSet-1" id="tab-commandSet-1" data-commandSet="1" class="tab" title="Command set 1">set 1</a>
<a href="#commandSet-2" id="tab-commandSet-2" data-commandSet="2" class="tab" title="Command set 2">set 2</a>
<a href="#commandSet-3" id="tab-commandSet-3" data-commandSet="3" class="tab" title="Command set 3">set 3</a>
</nav>
</section>
<button id="button-doCommands" type="button" title="Perform the current commands">do</button>
<button id="button-clearDrawing" type="button" title="Clear the drawing">clear</button>
<button id="button-origin" type="button" title="Return the turtle to the origin">to origin</button>
<input type="hidden" id="input-commandSet-active" name="commandSet-active" value="1">
<input type="hidden" id="input-commandSet-1" name="commandSet-1" value="// command set 1">
<input type="hidden" id="input-commandSet-2" name="commandSet-2" value="// command set 2">
<input type="hidden" id="input-commandSet-3" name="commandSet-3" value="// command set 3">
<h3>Position</h3>
<output id="turtle-info" class="infoBox"></output>
<button type="button" id="button-save">save drawing 🖬</button>
<a id="download-anchor" download="drawing.turtle.svg" href="" style="display:none;"></a>
<button type="button" id="button-showAppInfo"><strong>🛈 Turtle help</strong></button>
</form>
</div><!-- control-left -->
<div class="panel-group group-right">
<form id="form-page" tabindex="0" class="ui-panel">
<h2>Page</h2>
<fieldset class="flex1" title="Colour scheme">
<label title="Light scheme">
<input type="radio" name="colourScheme" class="colourScheme-selector" value="light" data-colourscheme="light">
light
</label>
<label title="Dark scheme">
<input type="radio" name="colourScheme" class="colourScheme-selector" value="dark" data-colourscheme="dark">
dark
</label>
<!--
<label title="auto">
<input type="radio" name="scheme" value="auto" checked>
▣
</label>
-->
</fieldset>
<label for="input-showTurtle" title="Show the turtle">
<input type="checkbox" name="showTurtle" id="input-showTurtle" checked>
show turtle
</label>
<label for="input-centerTurtle" title="Center the turtle on the page">
<input type="checkbox" name="centerTurtle" id="input-centerTurtle" checked>
center turtle
</label>
<label for="input-rotatePage" title="Rotate the page with the turtle's direction">
<input type="checkbox" name="rotatePage" id="input-rotatePage">
rotate page
</label>
<label for="input-zoom" class="zoom" title="Page zoom">
zoom
</label>
<input type="range" name="zoom" id="input-zoom" value="1" min="-1" max="3" list="datalist-zoom"/>
<datalist id="datalist-zoom">
<option value="-1">-1</option>
<option value="0">0</option>
<option value="1">+1</option>
<option value="2">+2</option>
<option value="3">+3</option>
</datalist>
<h3>Grid</h3>
<label for="input-showCartesian" title="Show the cartesian grid">
<input type="checkbox" name="showCartesian" id="input-showCartesian" checked>
cartesian
</label>
<input name="cartesianOpacity" id="input-cartesianOpacity" type="range" min="0.1" max="1" step="0.1" value="1" title="Cartesian grid opacity">
<label for="input-showPolar" title="Show the polar grid">
<input type="checkbox" name="showPolar" id="input-showPolar">
polar
</label>
<input name="polarOpacity" id="input-polarOpacity" type="range" min="0.1" max="1" step="0.1" value="0.7" title="Polar grid opacity">
<h3>Mouse</h3>
<label title="No action">
<input type="radio" name="mouse-click" value="na" checked>
no action
</label>
<label title="Point information">
<input type="radio" name="mouse-click" value="info">
point info
<button id="button-clearPoint" type="button" title="Clear point">clear</button><!-- <strong>⌧</strong> -->
</label>
<label title="Move the turtle">
<input type="radio" name="mouse-click" value="move">
move
</label>
<label title="Move and draw">
<input type="radio" name="mouse-click" value="draw">
draw
</label>
</form><!-- page -->
<form id="form-drawing" tabindex="0" class="ui-panel">
<h2>Drawing</h2>
<label for="input-colour" title="Drawing colour">
colour
</label>
<div class="flex1">
<input type="color" name="colour" id="input-colour" value="#ff7700"/>
</div>
<label for="input-strokeWidth" title="Drawing stroke-width">
stroke-width
</label>
<input type="range" name="strokeWidth" id="input-strokeWidth" value="10" min="1" max="20"/>
<label for="input-showStroke" title="Show the drawing stroke">
<input type="checkbox" name="showStroke" id="input-showStroke" checked>
stroke
</label>
<label for="input-showMarkers" title="Show markers">
<input type="checkbox" name="showMarkers" id="input-showMarkers" checked>
markers
</label>
</form>
</div><!-- control-right -->
<!-- svg-element
-->
<svg id="svg-element" class="svg-element" viewBox="-1200 -1200 2400 2400" preserveAspectRatio="xMidYMid meet" tabindex="0">
<defs>
<path id="def-marker" d="m0,-30 L10,10 L-10 10 z"/> <!-- class="marker" -->
<circle id="def-point" class="def-point"/>
<g class="grid">
<marker id="axisMarker-cartesian" class="axis" markerWidth="100" markerHeight="100" refX="0" refY="0" viewBox="-50 -50 100 100" orient="auto-start-reverse" markerUnits="userSpaceOnUse">
<path d="m-20,-20 L50,0 L-20,20 "/>
</marker>
<marker id="axisMarker-polar" class="axis" markerWidth="100" markerHeight="100" refX="0" refY="0" viewBox="-50 -50 100 100" orient="auto-start-reverse" markerUnits="userSpaceOnUse">
<path d="m20,-20 L0,50 L-20,-20"/>
</marker>
</g>
</defs>
<g id="group-page" class="page">
<g id="group-grid" class="grid">
<g id="group-polar">
<g id="group-polarGrid" class="polar-grid"></g>
<g id="group-polarPoint" class="polar-point"></g>
</g>
<g id="group-cartesian">
<g id="group-cartesianGrid" class="cartesian-grid"></g>
<g id="group-cartesianPoint" class="cartesian-point"></g>
</g>
</g>
<g id="group-drawing" class="drawing show-marker">
<!-- drawing elements go in here -->
</g>
<g id="group-turtle">
<!-- turtles go in here -->
</g>
</g><!-- page -->
</svg>
<dialog id="dialog-appInfo" closedby="any">
<h1>
<a href="https://github.com/ldpercy/turtle/">Turtle</a>
<a href="https://github.com/ldpercy/turtle/releases/tag/v0.14.0">v0.14.0</a>
by <a href="https://github.com/ldpercy/">ldpercy</a>
</h1>
<h2>Turtle commands</h2>
<dl>
<dt>left <em>degrees[,distance]</em></dt>
<dd>bear left for the given distance</dd>
<dt>right <em>degrees[,distance]</em></dt>
<dd>bear right for the given distance</dd>
<dt>bear <em>degrees[,distance]</em></dt>
<dd>bear w.r.t. to the polar direction</dd>
<dt>move <em>dx,dy</em></dt>
<dd>move in the turtle's local frame</dd>
<dt>xy <em>x,y</em></dt>
<dd>move to x,y without changing direction</dd>
<dt>xyTurn <em>x,y</em></dt>
<dd>move to x,y and turn to face the new direction</dd>
<dt>circle <em>radius</em></dt>
<dd>draw a circle with the given radius</dd>
<dt>ellipse <em>width,height</em></dt>
<dd>draw an ellipse with the given width & height</dd>
<dt>rect <em>width,height</em></dt>
<dd>draw a rectangle with the given width & height</dd>
<dt>text <em>string</em></dt>
<dd>draw text with the given string</dd>
<dt>marker</dt>
<dd>drop a marker flag - hover for position info</dd>
<dt>~<em>command</em></dt>
<dd>suppress drawing for any command</dd>
</dl>
<h2>Keyboard shortcuts</h2>
<dl>
<dt><kbd>d</kbd></dt>
<dd>Do commands</dd>
<dt><kbd>c</kbd></dt>
<dd>Clear the drawing</dd>
<dt><kbd>o</kbd></dt>
<dd>Return turtle to origin</dd>
<dt><kbd>!</kbd> (shift 1)</dt>
<dd>Show command tab 1</dd>
<dt><kbd>@</kbd> (shift 2)</dt>
<dd>Show command tab 2</dd>
<dt><kbd>#</kbd> (shift 3)</dt>
<dd>Show command tab 3</dd>
<dt><kbd>T</kbd></dt>
<dd>Toggle turtle visibility</dd>
<dt><kbd>C</kbd></dt>
<dd>Toggle turtle centering</dd>
<dt><kbd>R</kbd></dt>
<dd>Toggle page rotation</dd>
<dt><kbd>+</kbd> or <kbd>z</kbd></dt>
<dd>Zoom in</dd>
<dt><kbd>-</kbd> or <kbd>Z</kbd></dt>
<dd>Zoom out</dd>
<dt><kbd>?</kbd></dt>
<dd>Show this dialog</dd>
</dl>
</dialog>
</body>
</html>