-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
83 lines (72 loc) · 3.28 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="favicon.png" type="image/png">
<link rel="stylesheet" href="styles.css">
<script src="scripts.js"></script>
<!-- <script type="text/javascript" src="handwriting.js"></script> -->
<title>Static HTML with PNG Favicon</title>
</head>
<body>
<div class="contentarea">
<div class="camera">
<video id="video">Video stream not available.</video>
<button id="startbutton">Take photo</button>
</div>
<canvas id="canvas"> </canvas>
<div class="output">
<img id="photo" alt="The screen capture will appear in this box." />
</div>
</div>
<div class="contentarea">
<div class="article-style">
<canvas id="handwritingCanvas" width="400" height="400" style="border: 2px solid; cursor: crosshair;"></canvas>
<div>
PenSize <span id="lineWidth">3</span><input type="range" id="penSize" min="1" max="30"
value="3" data-ddg-inputtype="unknown">
<br>
<br>
<form>
Language:
<select id="language" data-ddg-inputtype="unknown">
<option value="fr" selected="selected">French</option>
</select>
</form>
<br>
<button onclick="handwritingCanvas.erase();">Erase</button>
<button onclick="
var e = document.getElementById('language');
handwritingCanvas.setOptions({language: e.options[e.selectedIndex].value});
handwritingCanvas.recognize();
">Send</button>
<button onclick="handwritingCanvas.undo()">Undo</button>
<button onclick="handwritingCanvas.redo()">Redo</button>
<br>
result: <span id="result"></span>
</div>
<script src="handwriting.canvas.js"></script>
<script>
console.log('Creating');
var handwritingCanvas= new handwriting.Canvas(document.getElementById('handwritingCanvas'), 3);
// var width = document.getElementById("demo").clientWidth
// handwritingCanvas.cxt.handwritingCanvas.width = width < 400 ? width : 400;
// handwritingCanvas.cxt.handwritingCanvas.height = width < 400 ? width : 400;
handwritingCanvas.setCallBack(function (data, err) {
if (err) throw err;
else document.getElementById("result").innerHTML = data;
});
handwritingCanvas.set_Undo_Redo(true, true);
var penSize = document.getElementById("penSize");
penSize.addEventListener("mousemove", function () {
document.getElementById("lineWidth").innerHTML = penSize.value;
});
penSize.addEventListener("change", function () {
handwritingCanvas.setLineWidth(penSize.value);
});
</script>
</div>
</div>
</body>
</html>