-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
270 lines (242 loc) · 11.2 KB
/
index.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- Binary Tree Visualizer by Michal Obara (mobaradev) -->
<title>Binary Tree Visualizer by mobaradev</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="src/css/main.css" type="text/css" />
</head>
<body>
<div class="panel">
<div class="panel-footer">
<img class="github-logo-img" src="src/images/github-mark.svg" alt="Github logo" height="18" />
<a href="https://github.com/mobaradev" target="_blank">mobaradev</a>
</div>
<div class="panel-wrapper">
<input class="panel-number-input" type="number" id="panel-action-number" />
<div class="panel-section" id="panel-buttons-container">
<button class="panel-button" id="panel-insert-button" title="Inserts the value into the tree.">Insert</button>
<button class="panel-button" id="panel-delete-left-button" title="Deletes the value from the tree. If the cell has both children, the child from the left will be promoted.">Delete (L)</button>
<button class="panel-button" id="panel-delete-right-button" title="Deletes the value from the tree. If the cell has both children, the child from the right will be promoted.">Delete (R)</button>
<button class="panel-button" id="panel-find-button" title="Returns a message with number of steps needed to find the value">Find</button>
</div>
<div class="clearfix"></div>
<hr class="panel-separator" />
<div class="clearfix"></div>
<div class="panel-section">
<div class="panel-subsection">
<div class="panel-subsection-title">Output message</div>
<div id="panel-output"></div>
</div>
</div>
<div class="clearfix"></div>
<div class="panel-section">
<div class="panel-subsection">
<div class="panel-subsection-title">Statistics</div>
<table>
<tr>
<td>Cells</td>
<td id="panel-statistics-cells"></td>
</tr>
<tr>
<td>Edges</td>
<td id="panel-statistics-edges"></td>
</tr>
<tr>
<td>Height</td>
<td id="panel-statistics-height"></td>
</tr>
<tr>
<td>Unique values</td>
<td id="panel-statistics-unique-values"></td>
</tr>
</table>
</div>
</div>
<div class="clearfix"></div>
<hr class="panel-separator" />
<div class="clearfix"></div>
<div class="panel-section">
<button class="panel-button" id="panel-about-button">About</button>
</div>
</div>
</div>
<div class="screen" id="start-screen">
<div class="screen-wrapper start-screen-wrapper">
<div class="centered-wrapper">
<div class="logo-with-author-full">
<h1>Binary Tree Visualizer</h1>
<p class="author">
by
<a href="https://github.com/mobaradev" target="_blank">mobaradev</a>
</p>
</div>
</div>
<div class="clearfix"></div>
<div>
<button class="panel-button" id="start-screen-start-empty-tree-button">Start with an empty tree</button>
<button class="panel-button" id="start-screen-start-random-tree-button">Start with a random tree</button>
</div>
<div class="clearfix"></div>
<div class="panel-separator transparent"></div>
<div>
<button class="panel-button" id="start-screen-about-button">About and help</button>
</div>
<div class="clearfix"></div>
<div class="panel-separator"></div>
<div class="start-screen-footer">
<div>
<img class="github-logo-img" src="src/images/github-mark.svg" alt="Github logo" height="18" />
<a href="https://github.com/mobaradev" target="_blank">mobaradev</a>
</div>
</div>
</div>
<span class="start-screen-version">version: <span id="app-version-number"></span></span>
</div>
<div class="screen hidden transparent" id="about-screen">
<div class="panel-button screen-x-button" id="about-screen-x-button">X</div>
<div class="screen-wrapper">
<div class="centered-wrapper">
<div class="logo-with-author-full">
<h1>Binary Tree Visualizer</h1>
<p class="author">
by
<a href="https://github.com/mobaradev" target="_blank">mobaradev</a>
</p>
</div>
</div>
<div class="clearfix"></div>
<h2>How to use</h2>
<h3>Getting started</h3>
<p>
Select the initial tree:
</p>
<ul>
<li>
Start with an empty tree
</li>
<li>
Start with a random tree
</li>
</ul>
<div class="clearfix"></div>
<h3>Manage your tree</h3>
<p>
Tree can be managed from the side-panel on the left.
</p>
<p>
Insert the number into the input area.
</p>
<img src="src/images/aboutScreen/a1.png" alt="Input area" height="100" />
<p>
This value will be used in functions available from the buttons below:
</p>
<ul>
<li>Insert</li>
<li>Delete (L)</li>
<li>Delete (R)</li>
<li>Find</li>
</ul>
<div class="clearfix"></div>
<h3>Control the camera</h3>
<h4>Zoom</h4>
<p>
You can zoom in or out using your mouse wheel or touchpad gestures.
</p>
<p>
Alternatively, you can use <b>Z</b> key to zoom out and <b>X</b> key to zoom in.
</p>
<h4>Position</h4>
<p>
You can change the camera position using mouse of touchpad gestures. Hold left button and move cursor at the same time.
</p>
<p>
Alternatively, you can use <b>WASD</b> keys.
</p>
<div class="clearfix"></div>
<h3>Observe tree's statistics</h3>
<p>
Statistics section provides numerical data that describes the tree.
</p>
<h4>Cells</h4>
<p>Number of cells in the tree</p>
<h4>Edges</h4>
<p>Number of edges in the tree. This value is equal to <b>number of cells - 1</b>, or <b>0</b> - when the tree is empty.</p>
<h4>Height</h4>
<p>Height of the tree. The higher tree, the more operations have to be done to execute the functions.</p>
<p>
<i>Example of tree with height = 5:</i>
</p>
<img src="src/images/aboutScreen/a2.png" alt="Example of tree with height = 5" height="300" />
<h4>Unique values</h4>
<p>Number of unique values in the tree. Two or more of the same values in the tree are counted as one.</p>
<div class="clearfix"></div>
<div class="panel-separator"></div>
<h2>Functions</h2>
<h3>Insert</h3>
<p>Inserts given value into the tree</p>
<h3>Delete (L)</h3>
<p>Deletes the value from the tree. If the cell has both children, the child from the left will be promoted.</p>
<p>
<i>Example:</i>
</p>
<img src="src/images/aboutScreen/a3.png" alt="Example of delete L" height="250" />
<h3>Delete (R)</h3>
<p>Deletes the value from the tree. If the cell has both children, the child from the right will be promoted.</p>
<p>
<i>Example:</i>
</p>
<img src="src/images/aboutScreen/a4.png" alt="Example of delete R" height="250" />
<h3>Find</h3>
<p>Returns a message with number of steps needed to find the value.</p>
<p>
<i>Example of finding value = 19 in the following tree:</i>
</p>
<img src="src/images/aboutScreen/a5.png" alt="Example of finding value = 19 in the tree" height="250" />
<p>
5 steps are needed to find this value
</p>
<div class="panel-separator"></div>
<h2>Author</h2>
<p>
Michal Obara
<br />
<a href="https://github.com/mobaradev" target="_blank">mobaradev on Github</a>
</p>
<div class="panel-separator"></div>
<h2>License</h2>
<p>
MIT License
<br /><br />
Copyright (c) 2022 Michal Obara
<br /><br />
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
<br /><br />
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
<br /><br />
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<br />
</p>
<div class="clearfix"></div>
<br />
</div>
</div>
<canvas id="canvas"></canvas>
<script src="src/js/Main.js" type="module"></script>
</body>
</html>