blob: 53ec0ec153406e0fc100b6b2f87752e2bf6fdb2b (
plain)
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
|
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--This is code modified from https://github.com/emscripten-core/emscripten/blob/main/src/shell_minimal.html.-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hitomezashi</title>
<style>
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
div.emscripten { text-align: center; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { border: 0px none; background-color: black; }
form {
display: table;
margin: auto;
}
form p {
display: table-row;
}
form label {
display: table-cell;
}
form input {
display: table-cell;
}
p#infoLink {
text-align: center;
}
p#infoLink a {
margin-left: 1ex;
margin-right: 1ex;
}
</style>
</head>
<body>
<p id="infoLink">See <a href="https://github.com/untir-l/hitomezashi/blob/main/README.md">the README</a> for information.</p>
<form name="hitomezashi parameters" autocomplete="off" method="get">
<p><label>x pattern: <input name="x_pattern"></label></p>
<p><label>y pattern: <input name="y_pattern"></label></p>
<p><label>gap: <input name="gap" type="number"></label></p>
<p><label>line thickness: <input name="line_thickness" type="number"></label></p>
<input type="submit" value="submit"></p>
</form>
<br>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
<script type='text/javascript'>
var Module = {
preRun: [],
postRun: [],
canvas: (function() {
var canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
};
const params = new URLSearchParams(window.location.search);
document.querySelector("input[name=\"x_pattern\"]").value = params.get("x_pattern");
document.querySelector("input[name=\"y_pattern\"]").value = params.get("y_pattern");
document.querySelector("input[name=\"gap\"]").value = params.get("gap");
document.querySelector("input[name=\"line_thickness\"]").value = params.get("line_thickness");
</script>
{{{ SCRIPT }}}
</body>
</html>
|