-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
116 lines (104 loc) · 2.79 KB
/
index.html
File metadata and controls
116 lines (104 loc) · 2.79 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>signature | capture</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
width: 100%;
height: 100vh;
overflow: hidden;
}
body {
width: 100%;
height: 100%;
overflow: hidden;
background: #000;
}
.nonny {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
flex-direction: column;
align-items: center;
overflow: auto;
}
#signatureCanvas {
width: 400px;
height: 200px;
display: block;
border: 1px solid #000;
cursor: crosshair;
background-color: #fff;
}
button {
padding: 8px;
border: none;
outline: none;
border-radius: 10px;
}
.action {
width: 100%;
display: flex;
justify-content: space-evenly;
flex-wrap: wrap;
margin-top: 10px;
}
button {
margin-top: 8px;
}
img {
background: #fff;
}
@media (max-width: 600px) {
.nonny {
width: 100%;
}
}
@media (max-width: 404px) {
#signatureCanvas {
width: 100%;
height: 200px;
display: block;
border: 1px solid #000;
cursor: crosshair;
background-color: #fff;
}
img {
width: 100%;
}
}
</style>
</head>
<body>
<div class="nonny" id="signature">
<canvas id="signatureCanvas" width="400" height="200"></canvas>
<div class="action">
<button type="button" class="nonny-clear">Clear</button>
<button type="button" class="nonny-save-png">Save png</button>
<button type="button" class="nonny-save-svg">Save svg</button>
<button type="button" class="nonny-save-callback">Onsave callback</button>
<button type="button" class="nonny-undo">Undo</button>
<button type="button" class="nonny-redo">Redo</button>
<input type="color" class="nonny-color" value="#000000" />
<input type="color" class="nonny-bgColor" value="#FFFFFF" />
<button type="button" class="nonny-sizeup">+</button>
<button type="button" class="nonny-sizedown">-</button>
<img src="" alt="">
</div>
</div>
<script src="lib/NonnySignature.js"></script>
<script>
const signature = new NonnySignature("#signature",true);
signature.onSave((img) => document.querySelector("img").src = img.toSvg());
</script>
</body>
</html>