-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
108 lines (108 loc) · 3.78 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>Document</title>
<style>
#image-edit{
width: 100%;
}
button{
margin: 5px;
}
</style>
</head>
<body>
<button class='button1'>清空全部</button>
<button class='button2'>撤销到上一步</button>
<button class='button3'>画圆</button>
<button class='button4'>画线</button>
<button class='button5'>输出图片</button>
<button class='button6'>输出只有线的图片</button>
<button class='button7'>输出只有圆的图片</button>
<button class='button8'>输出线分开的图片</button>
<button class='button9'>输出圆分开的图片</button>
<div id="image-edit"></div>
</body>
<!-- 操作canvas -->
<script type="module">
import ImageMark from "./index.js";
var a1= new ImageMark();
a1.init(
{
el:'image-edit',
url:'image/_20230118093410.png',
}
)
document.querySelector('.button1').addEventListener('click',function(){
a1.clearAll()
})
document.querySelector('.button2').addEventListener('click',function(){
a1.clearLast()
})
document.querySelector('.button3').addEventListener('click',function(){
a1.arc()
})
document.querySelector('.button4').addEventListener('click',function(){
a1.line()
})
document.querySelector('.button5').addEventListener('click',function(){
a1.getImageList({},function(ret){
var str=''
for(var i=0;i<ret.length;i++){
str+=`<img src="${ret[i]}" />`
}
document.querySelector('body').insertAdjacentHTML('beforeEnd',str)
})
})
document.querySelector('.button6').addEventListener('click',function(){
a1.getImageList({
rules:'line'
},function(ret){
var str=''
for(var i=0;i<ret.length;i++){
str+=`<img src="${ret[i]}" />`
}
document.querySelector('body').insertAdjacentHTML('beforeEnd',str)
})
})
document.querySelector('.button7').addEventListener('click',function(){
a1.getImageList({
rules:'arc'
},function(ret){
var str=''
for(var i=0;i<ret.length;i++){
str+=`<img src="${ret[i]}" />`
}
document.querySelector('body').insertAdjacentHTML('beforeEnd',str)
})
})
document.querySelector('.button8').addEventListener('click',function(){
a1.getImageList({
rules:'line',
methods:9
},function(ret){
var str=''
for(var i=0;i<ret.length;i++){
str+=`<img src="${ret[i]}" />`
}
document.querySelector('body').insertAdjacentHTML('beforeEnd',str)
})
})
document.querySelector('.button9').addEventListener('click',function(){
a1.getImageList({
rules:'arc',
methods:9
},function(ret){
var str=''
for(var i=0;i<ret.length;i++){
str+=`<img src="${ret[i]}" />`
}
document.querySelector('body').insertAdjacentHTML('beforeEnd',str)
})
})
</script>
</html>