-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard-lite.html
167 lines (149 loc) · 3.94 KB
/
board-lite.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
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>초대장 꾸미기 데모</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="title" content="초대장 꾸미기 데모"/>
<meta name="description" content="초대장 꾸미기 데모입니다."/>
<meta name="keywords" content="auoi, invitation"/>
<meta property="og:type" content="website"/>
<meta property="og:title" content="초대장 꾸미기 데모"/>
<meta property="og:description" content="초대장 꾸미기 데모입니다."/>
<meta name="format-detection" content="telephone=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="theme-color" content="#000000"/>
<link rel="stylesheet" href="./css/hanulse-board-lite.css?v=20230722"/>
<style>
html, body { margin: 0px; width: 100%; height: 100%; background-color: black;}
.board {
width: 100%;
height: 100%;
overflow: hidden;
}
</style>
</head>
<body>
<div class="board" style="width: 100%; height: 100%;"></div>
<script type="text/javascript" src="./js/view/board/HanulseBoardComponent.js"></script>
<script>
window.onload = () => {
window.example = new BoardExampleController();
};
class BoardExampleController {
boardComponent;
constructor() {
this.initialize();
}
initialize() {
const element = document.querySelector(".board");
this.boardComponent = new HanulseBoardComponent({
element: element,
width: 520,
height: 640,
});
this.boardComponent.setOnItemEdit((item) => alert('아이템 ' + item.id + '을 편집합니다.'));
}
download() {
this.boardComponent.toImageBlob((blob) => {
const filename = "card_" + Date.now() + ".png";
// Download image
const a = document.createElement("a");
a.style.display = "block";
a.download = filename;
a.href = window.URL.createObjectURL(blob);
document.body.appendChild(a);
a.click();
a.remove();
});
}
share() {
this.boardComponent.toImageBlob((blob) => {
const filename = "card_" + Date.now() + ".png";
const file = new File([blob], filename, { type: "image/png" });
if (navigator.share) {
navigator.share({
title: "당신을 초대합니다!",
text: "[RSVP] 초대장을 발권하였습니다!",
url: "https://www.auoi.net/board-light.html",
files: [file],
}).then(() => {
// alert("초대장을 공유하였습니다.");
})
.catch((e) => {
console.error(e);
// alert("초대장을 공유하지 못하였습니다.");
});
} else {
// alert("초대가 지원되지 않는 브라우저입니다.");
}
});
}
setBackground() {
this.boardComponent.setBackground({
id: 10012,
type: "image",
value: "./images/grass-top.png",
width: 69,
height: 35,
});
}
addImageItem() {
this.boardComponent.createItem({
id: 30001,
type: "image",
value: "./images/sample/sticker/1679536_animal_deer_forest_happy_reindeer_icon.png",
width: 64,
height: 64,
functions: {
resize4d: true,
resize8d: false,
resize2w: false,
resize2h: false,
'simple-transform': false,
rotate: true,
delete: true,
clone: false,
edit: true,
},
});
}
addTextItem() {
this.boardComponent.createItem({
type: 'text',
value: 'Hello World!!',
width: 200,
height: 80,
functions: {
resize4d: false,
resize8d: false,
resize2w: true,
resize2h: false,
'simple-transform': false,
rotate: true,
delete: true,
clone: false,
edit: true,
},
textStyle: {
color: '#ffc800',
backgroundColor: '#003366',
fontSize: 14,
fontFamily: 'sans-serif',
isFontBold: true,
isFontItalic: true,
},
});
}
setPlaceMode() {
this.boardComponent.setPointerMode('place');
}
setDrawingMode() {
this.boardComponent.setPointerMode('drawing');
}
}
</script>
</body>
</html>