Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,26 +9,33 @@ app = Flask(__name__)
|
|
| 9 |
|
| 10 |
@app.route('/')
|
| 11 |
def index():
|
|
|
|
| 12 |
return render_template_string(HTML_TEMPLATE)
|
| 13 |
|
| 14 |
@app.route('/webtoon.png')
|
| 15 |
def serve_webtoon_image():
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
import io
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
# ์ด๋ฏธ์ง๋ฅผ ๋ฐ์ดํธ๋ก ๋ณํ
|
| 25 |
img_io = io.BytesIO()
|
| 26 |
img.save(img_io, 'PNG')
|
| 27 |
img_io.seek(0)
|
| 28 |
|
| 29 |
return send_file(img_io, mimetype='image/png')
|
| 30 |
-
except:
|
| 31 |
-
return "Sample image", 200
|
| 32 |
|
| 33 |
|
| 34 |
|
|
@@ -49,20 +56,14 @@ HTML_TEMPLATE = '''
|
|
| 49 |
|
| 50 |
body {
|
| 51 |
font-family: 'Noto Sans KR', sans-serif;
|
| 52 |
-
background:
|
| 53 |
-
|
| 54 |
-
|
| 55 |
}
|
| 56 |
|
| 57 |
.container {
|
| 58 |
-
max-width: 1400px;
|
| 59 |
-
margin: 0 auto;
|
| 60 |
-
background: white;
|
| 61 |
-
border-radius: 20px;
|
| 62 |
-
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
| 63 |
-
overflow: hidden;
|
| 64 |
display: flex;
|
| 65 |
-
height:
|
| 66 |
}
|
| 67 |
|
| 68 |
/* ์ข์ธก ํด๋ฐ */
|
|
@@ -88,24 +89,15 @@ HTML_TEMPLATE = '''
|
|
| 88 |
}
|
| 89 |
|
| 90 |
.toolbar h2 {
|
| 91 |
-
font-size:
|
| 92 |
margin-bottom: 20px;
|
| 93 |
color: #fff;
|
| 94 |
border-bottom: 2px solid #4a9eff;
|
| 95 |
padding-bottom: 10px;
|
| 96 |
-
display: flex;
|
| 97 |
-
align-items: center;
|
| 98 |
-
gap: 10px;
|
| 99 |
}
|
| 100 |
|
| 101 |
.tool-section {
|
| 102 |
margin-bottom: 30px;
|
| 103 |
-
animation: fadeIn 0.5s ease-in;
|
| 104 |
-
}
|
| 105 |
-
|
| 106 |
-
@keyframes fadeIn {
|
| 107 |
-
from { opacity: 0; transform: translateY(10px); }
|
| 108 |
-
to { opacity: 1; transform: translateY(0); }
|
| 109 |
}
|
| 110 |
|
| 111 |
.tool-section h3 {
|
|
@@ -113,40 +105,28 @@ HTML_TEMPLATE = '''
|
|
| 113 |
margin-bottom: 15px;
|
| 114 |
color: #aaa;
|
| 115 |
text-transform: uppercase;
|
| 116 |
-
letter-spacing: 1px;
|
| 117 |
}
|
| 118 |
|
| 119 |
/* ํ์ผ ์
๋ก๋ ์์ญ */
|
| 120 |
.file-upload {
|
| 121 |
border: 2px dashed #4a9eff;
|
| 122 |
-
border-radius:
|
| 123 |
-
padding:
|
| 124 |
text-align: center;
|
| 125 |
cursor: pointer;
|
| 126 |
transition: all 0.3s;
|
| 127 |
margin-bottom: 20px;
|
| 128 |
-
background: linear-gradient(135deg, rgba(74, 158, 255, 0.1), rgba(118, 75, 162, 0.1));
|
| 129 |
}
|
| 130 |
|
| 131 |
.file-upload:hover {
|
| 132 |
-
background:
|
| 133 |
border-color: #6ab7ff;
|
| 134 |
-
transform: scale(1.02);
|
| 135 |
}
|
| 136 |
|
| 137 |
.file-upload input {
|
| 138 |
display: none;
|
| 139 |
}
|
| 140 |
|
| 141 |
-
.file-upload svg {
|
| 142 |
-
animation: float 3s ease-in-out infinite;
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
@keyframes float {
|
| 146 |
-
0%, 100% { transform: translateY(0); }
|
| 147 |
-
50% { transform: translateY(-10px); }
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
/* ํ์ผ ๋ฆฌ์คํธ */
|
| 151 |
.file-list {
|
| 152 |
background: #333;
|
|
@@ -160,15 +140,8 @@ HTML_TEMPLATE = '''
|
|
| 160 |
.file-item {
|
| 161 |
font-size: 12px;
|
| 162 |
color: #aaa;
|
| 163 |
-
padding:
|
| 164 |
border-bottom: 1px solid #444;
|
| 165 |
-
transition: all 0.3s;
|
| 166 |
-
}
|
| 167 |
-
|
| 168 |
-
.file-item:hover {
|
| 169 |
-
background: rgba(74, 158, 255, 0.1);
|
| 170 |
-
color: #4a9eff;
|
| 171 |
-
padding-left: 10px;
|
| 172 |
}
|
| 173 |
|
| 174 |
.file-item:last-child {
|
|
@@ -179,68 +152,43 @@ HTML_TEMPLATE = '''
|
|
| 179 |
.component-grid {
|
| 180 |
display: grid;
|
| 181 |
grid-template-columns: repeat(3, 1fr);
|
| 182 |
-
gap:
|
| 183 |
}
|
| 184 |
|
| 185 |
.component-btn {
|
| 186 |
-
background:
|
| 187 |
border: 1px solid #555;
|
| 188 |
-
border-radius:
|
| 189 |
-
padding:
|
| 190 |
cursor: pointer;
|
| 191 |
transition: all 0.3s;
|
| 192 |
text-align: center;
|
| 193 |
color: #fff;
|
| 194 |
-
position: relative;
|
| 195 |
-
overflow: hidden;
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
.component-btn::before {
|
| 199 |
-
content: '';
|
| 200 |
-
position: absolute;
|
| 201 |
-
top: 50%;
|
| 202 |
-
left: 50%;
|
| 203 |
-
width: 0;
|
| 204 |
-
height: 0;
|
| 205 |
-
background: radial-gradient(circle, rgba(74, 158, 255, 0.3), transparent);
|
| 206 |
-
transform: translate(-50%, -50%);
|
| 207 |
-
transition: width 0.3s, height 0.3s;
|
| 208 |
-
}
|
| 209 |
-
|
| 210 |
-
.component-btn:hover::before {
|
| 211 |
-
width: 100%;
|
| 212 |
-
height: 100%;
|
| 213 |
}
|
| 214 |
|
| 215 |
.component-btn:hover {
|
| 216 |
-
background:
|
| 217 |
border-color: #4a9eff;
|
| 218 |
-
transform: translateY(-
|
| 219 |
-
box-shadow: 0 5px 15px rgba(74, 158, 255, 0.3);
|
| 220 |
}
|
| 221 |
|
| 222 |
.component-btn svg {
|
| 223 |
-
width:
|
| 224 |
-
height:
|
| 225 |
-
margin-bottom:
|
| 226 |
-
position: relative;
|
| 227 |
-
z-index: 1;
|
| 228 |
}
|
| 229 |
|
| 230 |
.component-btn span {
|
| 231 |
display: block;
|
| 232 |
font-size: 11px;
|
| 233 |
-
position: relative;
|
| 234 |
-
z-index: 1;
|
| 235 |
}
|
| 236 |
|
| 237 |
/* ์์ฑ ํธ์ง ํจ๋ */
|
| 238 |
.properties-panel {
|
| 239 |
-
background:
|
| 240 |
-
border-radius:
|
| 241 |
padding: 15px;
|
| 242 |
margin-top: 20px;
|
| 243 |
-
box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
|
| 244 |
}
|
| 245 |
|
| 246 |
.property-group {
|
|
@@ -251,54 +199,37 @@ HTML_TEMPLATE = '''
|
|
| 251 |
display: block;
|
| 252 |
font-size: 12px;
|
| 253 |
color: #aaa;
|
| 254 |
-
margin-bottom:
|
| 255 |
-
text-transform: uppercase;
|
| 256 |
-
letter-spacing: 0.5px;
|
| 257 |
}
|
| 258 |
|
| 259 |
.property-group input,
|
| 260 |
.property-group select,
|
| 261 |
.property-group textarea {
|
| 262 |
width: 100%;
|
| 263 |
-
padding:
|
| 264 |
background: #2a2a2a;
|
| 265 |
border: 1px solid #444;
|
| 266 |
-
border-radius:
|
| 267 |
color: #fff;
|
| 268 |
-
transition: all 0.3s;
|
| 269 |
-
}
|
| 270 |
-
|
| 271 |
-
.property-group input:focus,
|
| 272 |
-
.property-group select:focus,
|
| 273 |
-
.property-group textarea:focus {
|
| 274 |
-
border-color: #4a9eff;
|
| 275 |
-
box-shadow: 0 0 10px rgba(74, 158, 255, 0.2);
|
| 276 |
-
outline: none;
|
| 277 |
}
|
| 278 |
|
| 279 |
.color-picker {
|
| 280 |
display: grid;
|
| 281 |
grid-template-columns: repeat(6, 1fr);
|
| 282 |
-
gap:
|
| 283 |
}
|
| 284 |
|
| 285 |
.color-option {
|
| 286 |
width: 35px;
|
| 287 |
height: 35px;
|
| 288 |
-
border-radius:
|
| 289 |
cursor: pointer;
|
| 290 |
border: 2px solid transparent;
|
| 291 |
-
transition: all 0.3s;
|
| 292 |
-
}
|
| 293 |
-
|
| 294 |
-
.color-option:hover {
|
| 295 |
-
transform: scale(1.2);
|
| 296 |
}
|
| 297 |
|
| 298 |
.color-option.selected {
|
| 299 |
border-color: #4a9eff;
|
| 300 |
-
box-shadow: 0 0
|
| 301 |
-
transform: scale(1.1);
|
| 302 |
}
|
| 303 |
|
| 304 |
/* ๋ฉ์ธ ์์
์์ญ */
|
|
@@ -306,106 +237,80 @@ HTML_TEMPLATE = '''
|
|
| 306 |
flex: 1;
|
| 307 |
display: flex;
|
| 308 |
flex-direction: column;
|
| 309 |
-
background: #
|
| 310 |
}
|
| 311 |
|
| 312 |
.workspace-header {
|
| 313 |
-
background:
|
| 314 |
padding: 15px 20px;
|
| 315 |
-
|
| 316 |
display: flex;
|
| 317 |
justify-content: space-between;
|
| 318 |
align-items: center;
|
| 319 |
}
|
| 320 |
|
| 321 |
-
.workspace-header h1 {
|
| 322 |
-
color: white;
|
| 323 |
-
font-size: 22px;
|
| 324 |
-
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
|
| 325 |
-
}
|
| 326 |
-
|
| 327 |
.workspace-tools {
|
| 328 |
display: flex;
|
| 329 |
gap: 10px;
|
| 330 |
}
|
| 331 |
|
| 332 |
.tool-btn {
|
| 333 |
-
background:
|
| 334 |
-
border: 1px solid
|
| 335 |
-
border-radius:
|
| 336 |
-
padding:
|
| 337 |
color: #fff;
|
| 338 |
cursor: pointer;
|
| 339 |
transition: all 0.3s;
|
| 340 |
-
backdrop-filter: blur(10px);
|
| 341 |
-
font-weight: 500;
|
| 342 |
}
|
| 343 |
|
| 344 |
.tool-btn:hover {
|
| 345 |
-
background:
|
| 346 |
-
|
| 347 |
-
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
| 348 |
}
|
| 349 |
|
| 350 |
.tool-btn.primary {
|
| 351 |
-
background:
|
| 352 |
-
border:
|
| 353 |
}
|
| 354 |
|
| 355 |
.tool-btn.primary:hover {
|
| 356 |
-
background:
|
| 357 |
-
}
|
| 358 |
-
|
| 359 |
-
.tool-btn.danger {
|
| 360 |
-
background: linear-gradient(135deg, #ff4757, #ff6b7a);
|
| 361 |
-
border: none;
|
| 362 |
-
}
|
| 363 |
-
|
| 364 |
-
.tool-btn.danger:hover {
|
| 365 |
-
background: linear-gradient(135deg, #ff6b7a, #ff8997);
|
| 366 |
}
|
| 367 |
|
| 368 |
/* ์บ๋ฒ์ค ์์ญ */
|
| 369 |
.canvas-container {
|
| 370 |
flex: 1;
|
| 371 |
overflow: auto;
|
| 372 |
-
padding:
|
| 373 |
display: flex;
|
| 374 |
justify-content: center;
|
| 375 |
-
background:
|
| 376 |
position: relative;
|
| 377 |
}
|
| 378 |
|
| 379 |
.canvas-wrapper {
|
| 380 |
position: relative;
|
| 381 |
background: white;
|
| 382 |
-
box-shadow: 0
|
| 383 |
min-height: 800px;
|
| 384 |
width: 700px;
|
| 385 |
-
border-radius: 10px;
|
| 386 |
-
overflow: hidden;
|
| 387 |
}
|
| 388 |
|
| 389 |
/* ์ด๋ฏธ์ง ์ปจํ
์ด๋ */
|
| 390 |
.image-container {
|
| 391 |
position: relative;
|
| 392 |
width: 100%;
|
| 393 |
-
animation: slideIn 0.5s ease-out;
|
| 394 |
-
}
|
| 395 |
-
|
| 396 |
-
@keyframes slideIn {
|
| 397 |
-
from { opacity: 0; transform: translateX(-20px); }
|
| 398 |
-
to { opacity: 1; transform: translateX(0); }
|
| 399 |
}
|
| 400 |
|
| 401 |
.image-number {
|
| 402 |
position: absolute;
|
| 403 |
-
left: -
|
| 404 |
top: 10px;
|
| 405 |
-
background:
|
| 406 |
color: white;
|
| 407 |
-
width:
|
| 408 |
-
height:
|
| 409 |
border-radius: 50%;
|
| 410 |
display: flex;
|
| 411 |
align-items: center;
|
|
@@ -413,7 +318,7 @@ HTML_TEMPLATE = '''
|
|
| 413 |
font-weight: bold;
|
| 414 |
font-size: 14px;
|
| 415 |
z-index: 10;
|
| 416 |
-
box-shadow: 0
|
| 417 |
}
|
| 418 |
|
| 419 |
.webtoon-image {
|
|
@@ -428,40 +333,35 @@ HTML_TEMPLATE = '''
|
|
| 428 |
cursor: move;
|
| 429 |
user-select: none;
|
| 430 |
z-index: 50;
|
| 431 |
-
transition: box-shadow 0.3s;
|
| 432 |
}
|
| 433 |
|
| 434 |
.draggable-component.dragging {
|
| 435 |
z-index: 1000;
|
| 436 |
-
opacity: 0.
|
| 437 |
-
box-shadow: 0 10px 30px rgba(0,0,0,0.3);
|
| 438 |
}
|
| 439 |
|
| 440 |
.draggable-component.selected {
|
| 441 |
outline: 2px solid #4a9eff;
|
| 442 |
z-index: 100;
|
| 443 |
-
box-shadow: 0 0 20px rgba(74, 158, 255, 0.3);
|
| 444 |
}
|
| 445 |
|
| 446 |
.draggable-component .resize-handle {
|
| 447 |
position: absolute;
|
| 448 |
-
width:
|
| 449 |
-
height:
|
| 450 |
-
background:
|
| 451 |
-
border:
|
| 452 |
-
border-radius: 50%;
|
| 453 |
display: none;
|
| 454 |
-
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
| 455 |
}
|
| 456 |
|
| 457 |
.draggable-component.selected .resize-handle {
|
| 458 |
display: block;
|
| 459 |
}
|
| 460 |
|
| 461 |
-
.resize-handle.nw { top: -
|
| 462 |
-
.resize-handle.ne { top: -
|
| 463 |
-
.resize-handle.sw { bottom: -
|
| 464 |
-
.resize-handle.se { bottom: -
|
| 465 |
|
| 466 |
/* ๋งํ์ ์คํ์ผ๋ค */
|
| 467 |
.speech-bubble {
|
|
@@ -480,6 +380,12 @@ HTML_TEMPLATE = '''
|
|
| 480 |
box-sizing: border-box;
|
| 481 |
}
|
| 482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
.speech-bubble-tail {
|
| 484 |
position: absolute;
|
| 485 |
bottom: -10px;
|
|
@@ -519,6 +425,12 @@ HTML_TEMPLATE = '''
|
|
| 519 |
box-sizing: border-box;
|
| 520 |
}
|
| 521 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
.thought-bubble-dots {
|
| 523 |
position: absolute;
|
| 524 |
bottom: -25px;
|
|
@@ -611,8 +523,7 @@ HTML_TEMPLATE = '''
|
|
| 611 |
width: 100%;
|
| 612 |
height: 100%;
|
| 613 |
font-weight: bold;
|
| 614 |
-
text-shadow:
|
| 615 |
-
2px 2px 0 black, -2px -2px 0 black, 2px -2px 0 black, -2px 2px 0 black;
|
| 616 |
display: flex;
|
| 617 |
align-items: center;
|
| 618 |
justify-content: center;
|
|
@@ -659,7 +570,6 @@ HTML_TEMPLATE = '''
|
|
| 659 |
display: flex;
|
| 660 |
align-items: center;
|
| 661 |
justify-content: center;
|
| 662 |
-
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
| 663 |
}
|
| 664 |
|
| 665 |
.gradient-box .component-text {
|
|
@@ -692,12 +602,11 @@ HTML_TEMPLATE = '''
|
|
| 692 |
top: 50%;
|
| 693 |
left: 50%;
|
| 694 |
transform: translate(-50%, -50%);
|
| 695 |
-
background:
|
| 696 |
-
padding:
|
| 697 |
-
border-radius:
|
| 698 |
z-index: 10000;
|
| 699 |
text-align: center;
|
| 700 |
-
box-shadow: 0 10px 40px rgba(0,0,0,0.5);
|
| 701 |
}
|
| 702 |
|
| 703 |
.loading.active {
|
|
@@ -705,13 +614,13 @@ HTML_TEMPLATE = '''
|
|
| 705 |
}
|
| 706 |
|
| 707 |
.loading-spinner {
|
| 708 |
-
border:
|
| 709 |
-
border-top:
|
| 710 |
border-radius: 50%;
|
| 711 |
-
width:
|
| 712 |
-
height:
|
| 713 |
animation: spin 1s linear infinite;
|
| 714 |
-
margin: 0 auto
|
| 715 |
}
|
| 716 |
|
| 717 |
@keyframes spin {
|
|
@@ -719,11 +628,6 @@ HTML_TEMPLATE = '''
|
|
| 719 |
100% { transform: rotate(360deg); }
|
| 720 |
}
|
| 721 |
|
| 722 |
-
.loading p {
|
| 723 |
-
color: white;
|
| 724 |
-
font-size: 16px;
|
| 725 |
-
}
|
| 726 |
-
|
| 727 |
/* ์ด๋ฏธ์ง ๊ฐ๊ฒฉ ์กฐ์ */
|
| 728 |
.spacing-control {
|
| 729 |
display: flex;
|
|
@@ -733,93 +637,36 @@ HTML_TEMPLATE = '''
|
|
| 733 |
|
| 734 |
.spacing-control input[type="range"] {
|
| 735 |
flex: 1;
|
| 736 |
-
height: 6px;
|
| 737 |
-
-webkit-appearance: none;
|
| 738 |
-
appearance: none;
|
| 739 |
-
background: #333;
|
| 740 |
-
border-radius: 3px;
|
| 741 |
-
outline: none;
|
| 742 |
-
}
|
| 743 |
-
|
| 744 |
-
.spacing-control input[type="range"]::-webkit-slider-thumb {
|
| 745 |
-
-webkit-appearance: none;
|
| 746 |
-
appearance: none;
|
| 747 |
-
width: 18px;
|
| 748 |
-
height: 18px;
|
| 749 |
-
border-radius: 50%;
|
| 750 |
-
background: linear-gradient(135deg, #4a9eff, #6ab7ff);
|
| 751 |
-
cursor: pointer;
|
| 752 |
}
|
| 753 |
|
| 754 |
.spacing-value {
|
| 755 |
width: 50px;
|
| 756 |
text-align: center;
|
| 757 |
-
color: #4a9eff;
|
| 758 |
-
font-weight: bold;
|
| 759 |
}
|
| 760 |
|
| 761 |
/* ๊ฐ๋ณ ์ ์ฅ ์
๋ ฅ */
|
| 762 |
.save-individual {
|
| 763 |
display: flex;
|
| 764 |
-
gap:
|
| 765 |
margin-top: 10px;
|
| 766 |
}
|
| 767 |
|
| 768 |
.save-individual input {
|
| 769 |
-
width:
|
| 770 |
-
padding: 8px;
|
| 771 |
-
background: #2a2a2a;
|
| 772 |
-
border: 1px solid #444;
|
| 773 |
-
border-radius: 6px;
|
| 774 |
-
color: white;
|
| 775 |
}
|
| 776 |
|
| 777 |
.save-individual button {
|
| 778 |
flex: 1;
|
| 779 |
-
padding:
|
| 780 |
-
background:
|
| 781 |
border: none;
|
| 782 |
-
border-radius:
|
| 783 |
color: white;
|
| 784 |
cursor: pointer;
|
| 785 |
-
font-weight: 500;
|
| 786 |
-
transition: all 0.3s;
|
| 787 |
}
|
| 788 |
|
| 789 |
.save-individual button:hover {
|
| 790 |
-
background:
|
| 791 |
-
transform: translateY(-2px);
|
| 792 |
-
box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
|
| 793 |
-
}
|
| 794 |
-
|
| 795 |
-
/* ๋น ์ํ ๋ฉ์์ง */
|
| 796 |
-
.empty-state {
|
| 797 |
-
display: flex;
|
| 798 |
-
flex-direction: column;
|
| 799 |
-
align-items: center;
|
| 800 |
-
justify-content: center;
|
| 801 |
-
height: 100%;
|
| 802 |
-
color: #999;
|
| 803 |
-
text-align: center;
|
| 804 |
-
padding: 40px;
|
| 805 |
-
}
|
| 806 |
-
|
| 807 |
-
.empty-state svg {
|
| 808 |
-
width: 100px;
|
| 809 |
-
height: 100px;
|
| 810 |
-
margin-bottom: 20px;
|
| 811 |
-
opacity: 0.5;
|
| 812 |
-
}
|
| 813 |
-
|
| 814 |
-
.empty-state h3 {
|
| 815 |
-
font-size: 24px;
|
| 816 |
-
margin-bottom: 10px;
|
| 817 |
-
color: #666;
|
| 818 |
-
}
|
| 819 |
-
|
| 820 |
-
.empty-state p {
|
| 821 |
-
font-size: 14px;
|
| 822 |
-
color: #999;
|
| 823 |
}
|
| 824 |
</style>
|
| 825 |
</head>
|
|
@@ -827,22 +674,19 @@ HTML_TEMPLATE = '''
|
|
| 827 |
<div class="container">
|
| 828 |
<!-- ์ข์ธก ํด๋ฐ -->
|
| 829 |
<div class="toolbar">
|
| 830 |
-
<h2>
|
| 831 |
-
<span>๐จ</span>
|
| 832 |
-
<span>์นํฐ ํธ์ง ๋๊ตฌ</span>
|
| 833 |
-
</h2>
|
| 834 |
|
| 835 |
<!-- ํ์ผ ์
๋ก๋ -->
|
| 836 |
<div class="tool-section">
|
| 837 |
<h3>๐ ์ด๋ฏธ์ง ์
๋ก๋</h3>
|
| 838 |
<div class="file-upload" onclick="document.getElementById('fileInput').click()">
|
| 839 |
-
<svg width="
|
| 840 |
-
<rect x="
|
| 841 |
-
<polyline points="20,
|
| 842 |
-
<line x1="
|
| 843 |
</svg>
|
| 844 |
-
<p
|
| 845 |
-
<p style="font-size: 11px; color: #888; margin-top: 5px;"
|
| 846 |
<input type="file" id="fileInput" multiple accept="image/*">
|
| 847 |
</div>
|
| 848 |
<div id="fileList"></div>
|
|
@@ -861,7 +705,7 @@ HTML_TEMPLATE = '''
|
|
| 861 |
<label>๊ฐ๋ณ ์ด๋ฏธ์ง ์ ์ฅ</label>
|
| 862 |
<div class="save-individual">
|
| 863 |
<input type="number" id="imageNumber" placeholder="๋ฒํธ" min="1">
|
| 864 |
-
<button onclick="exportSingleImage()"
|
| 865 |
</div>
|
| 866 |
</div>
|
| 867 |
</div>
|
|
@@ -905,7 +749,7 @@ HTML_TEMPLATE = '''
|
|
| 905 |
</div>
|
| 906 |
<div class="component-btn" onclick="addComponent('action')">
|
| 907 |
<svg viewBox="0 0 100 100" fill="none" stroke="white" stroke-width="2">
|
| 908 |
-
<text x="50" y="
|
| 909 |
</svg>
|
| 910 |
<span>ํจ๊ณผ์</span>
|
| 911 |
</div>
|
|
@@ -921,6 +765,12 @@ HTML_TEMPLATE = '''
|
|
| 921 |
</svg>
|
| 922 |
<span>ํ
์คํธ๋ฐ์ค</span>
|
| 923 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 924 |
<div class="component-btn" onclick="addComponent('gradient')">
|
| 925 |
<svg viewBox="0 0 100 100">
|
| 926 |
<defs>
|
|
@@ -947,6 +797,8 @@ HTML_TEMPLATE = '''
|
|
| 947 |
<option value="Arial">Arial</option>
|
| 948 |
<option value="Verdana">Verdana</option>
|
| 949 |
<option value="Georgia">Georgia</option>
|
|
|
|
|
|
|
| 950 |
<option value="'Comic Sans MS'">Comic Sans MS</option>
|
| 951 |
</optgroup>
|
| 952 |
<optgroup label="ํ๊ธ ํฐํธ">
|
|
@@ -1008,25 +860,17 @@ HTML_TEMPLATE = '''
|
|
| 1008 |
<!-- ๋ฉ์ธ ์์
์์ญ -->
|
| 1009 |
<div class="workspace">
|
| 1010 |
<div class="workspace-header">
|
| 1011 |
-
<h1>๐จ ์นํฐ ํธ์ง ์คํ๋์ค Pro</h1>
|
| 1012 |
<div class="workspace-tools">
|
| 1013 |
-
<button class="tool-btn
|
| 1014 |
<button class="tool-btn" onclick="clearAll()">๐ ์ ์ฒด ์ด๊ธฐํ</button>
|
| 1015 |
-
<button class="tool-btn primary" onclick="
|
| 1016 |
</div>
|
| 1017 |
</div>
|
| 1018 |
|
| 1019 |
<div class="canvas-container">
|
| 1020 |
<div class="canvas-wrapper" id="canvas">
|
| 1021 |
-
|
| 1022 |
-
<svg viewBox="0 0 100 100" fill="none" stroke="#ccc" stroke-width="2">
|
| 1023 |
-
<rect x="20" y="30" width="60" height="40" stroke-dasharray="5,5"/>
|
| 1024 |
-
<circle cx="35" cy="45" r="5"/>
|
| 1025 |
-
<path d="M 30 55 L 40 45 L 50 50 L 60 40 L 70 55"/>
|
| 1026 |
-
</svg>
|
| 1027 |
-
<h3>์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ์ธ์</h3>
|
| 1028 |
-
<p>์ข์ธก ์๋จ์ ์
๋ก๋ ๋ฒํผ์ ํด๋ฆญํ์ฌ<br>์นํฐ ์ด๋ฏธ์ง๋ฅผ ๋ถ๋ฌ์ค์ธ์</p>
|
| 1029 |
-
</div>
|
| 1030 |
</div>
|
| 1031 |
</div>
|
| 1032 |
</div>
|
|
@@ -1049,7 +893,63 @@ HTML_TEMPLATE = '''
|
|
| 1049 |
let selectedColor = 'black';
|
| 1050 |
let uploadedImages = [];
|
| 1051 |
let currentDragElement = null;
|
| 1052 |
-
const DEFAULT_FONT_SIZE = 22;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1053 |
|
| 1054 |
// ์์ฐ์ค๋ฌ์ด ์ ๋ ฌ ํจ์
|
| 1055 |
function naturalSort(a, b) {
|
|
@@ -1071,14 +971,6 @@ HTML_TEMPLATE = '''
|
|
| 1071 |
// ํ์ผ ์
๋ก๋ ์ฒ๋ฆฌ
|
| 1072 |
document.getElementById('fileInput').addEventListener('change', async function(e) {
|
| 1073 |
const files = Array.from(e.target.files);
|
| 1074 |
-
if (files.length === 0) return;
|
| 1075 |
-
|
| 1076 |
-
// ๋น ์ํ ๋ฉ์์ง ์จ๊ธฐ๊ธฐ
|
| 1077 |
-
const emptyState = document.getElementById('emptyState');
|
| 1078 |
-
if (emptyState) {
|
| 1079 |
-
emptyState.style.display = 'none';
|
| 1080 |
-
}
|
| 1081 |
-
|
| 1082 |
files.sort(naturalSort);
|
| 1083 |
|
| 1084 |
const canvas = document.getElementById('canvas');
|
|
@@ -1157,14 +1049,8 @@ HTML_TEMPLATE = '''
|
|
| 1157 |
});
|
| 1158 |
}
|
| 1159 |
|
| 1160 |
-
// ์ปดํฌ๋ํธ ์ถ๊ฐ
|
| 1161 |
function addComponent(type) {
|
| 1162 |
-
// ์ด๋ฏธ์ง๊ฐ ์์ผ๋ฉด ๊ฒฝ๊ณ
|
| 1163 |
-
if (uploadedImages.length === 0) {
|
| 1164 |
-
alert('๋จผ์ ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํด์ฃผ์ธ์!');
|
| 1165 |
-
return;
|
| 1166 |
-
}
|
| 1167 |
-
|
| 1168 |
const canvas = document.getElementById('canvas');
|
| 1169 |
const component = document.createElement('div');
|
| 1170 |
component.className = 'draggable-component';
|
|
@@ -1234,6 +1120,12 @@ HTML_TEMPLATE = '''
|
|
| 1234 |
<textarea class="component-text" placeholder="ํ
์คํธ ์
๋ ฅ..." style="font-size: ${DEFAULT_FONT_SIZE}px;"></textarea>
|
| 1235 |
</div>`;
|
| 1236 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1237 |
case 'gradient':
|
| 1238 |
innerContent = `
|
| 1239 |
<div class="gradient-box">
|
|
@@ -1303,6 +1195,7 @@ HTML_TEMPLATE = '''
|
|
| 1303 |
isDragging = true;
|
| 1304 |
currentDragElement = component;
|
| 1305 |
|
|
|
|
| 1306 |
component.classList.add('dragging');
|
| 1307 |
|
| 1308 |
const canvasRect = document.getElementById('canvas').getBoundingClientRect();
|
|
@@ -1328,6 +1221,7 @@ HTML_TEMPLATE = '''
|
|
| 1328 |
let newX = e.clientX - canvasRect.left - dragOffset.x;
|
| 1329 |
let newY = e.clientY - canvasRect.top - dragOffset.y + containerScrollTop;
|
| 1330 |
|
|
|
|
| 1331 |
newX = Math.max(0, Math.min(newX, canvas.offsetWidth - currentDragElement.offsetWidth));
|
| 1332 |
newY = Math.max(0, newY);
|
| 1333 |
|
|
@@ -1497,11 +1391,25 @@ HTML_TEMPLATE = '''
|
|
| 1497 |
tempContainer.style.left = '-9999px';
|
| 1498 |
document.body.appendChild(tempContainer);
|
| 1499 |
|
|
|
|
| 1500 |
html2canvas(tempContainer, {
|
| 1501 |
backgroundColor: '#ffffff',
|
| 1502 |
scale: 2,
|
| 1503 |
useCORS: true,
|
| 1504 |
-
logging: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1505 |
}).then(function(canvas) {
|
| 1506 |
const link = document.createElement('a');
|
| 1507 |
link.download = 'webtoon_' + imageNumber + '_' + new Date().getTime() + '.png';
|
|
@@ -1524,55 +1432,6 @@ HTML_TEMPLATE = '''
|
|
| 1524 |
});
|
| 1525 |
}
|
| 1526 |
|
| 1527 |
-
// ์ ์ฒด ์ด๋ฏธ์ง ์ ์ฅ
|
| 1528 |
-
function exportAllImages() {
|
| 1529 |
-
if (uploadedImages.length === 0) {
|
| 1530 |
-
alert('โ ๏ธ ์ ์ฅํ ์ด๋ฏธ์ง๊ฐ ์์ต๋๋ค.');
|
| 1531 |
-
return;
|
| 1532 |
-
}
|
| 1533 |
-
|
| 1534 |
-
const loading = document.getElementById('loading');
|
| 1535 |
-
loading.classList.add('active');
|
| 1536 |
-
|
| 1537 |
-
// ๋ชจ๋ ์ปดํฌ๋ํธ ์ ํ ํด์
|
| 1538 |
-
document.querySelectorAll('.draggable-component').forEach(c => {
|
| 1539 |
-
c.classList.remove('selected');
|
| 1540 |
-
});
|
| 1541 |
-
|
| 1542 |
-
// ๋ชจ๋ ๋ฒํธ ๋ผ๋ฒจ ์จ๊ธฐ๊ธฐ
|
| 1543 |
-
document.querySelectorAll('.image-number').forEach(label => {
|
| 1544 |
-
label.style.display = 'none';
|
| 1545 |
-
});
|
| 1546 |
-
|
| 1547 |
-
html2canvas(document.getElementById('canvas'), {
|
| 1548 |
-
backgroundColor: '#ffffff',
|
| 1549 |
-
scale: 2,
|
| 1550 |
-
useCORS: true,
|
| 1551 |
-
logging: false
|
| 1552 |
-
}).then(function(canvas) {
|
| 1553 |
-
const link = document.createElement('a');
|
| 1554 |
-
link.download = 'webtoon_complete_' + new Date().getTime() + '.png';
|
| 1555 |
-
link.href = canvas.toDataURL('image/png');
|
| 1556 |
-
link.click();
|
| 1557 |
-
|
| 1558 |
-
// ๋ฒํธ ๋ผ๋ฒจ ๋ค์ ํ์
|
| 1559 |
-
document.querySelectorAll('.image-number').forEach(label => {
|
| 1560 |
-
label.style.display = 'flex';
|
| 1561 |
-
});
|
| 1562 |
-
|
| 1563 |
-
loading.classList.remove('active');
|
| 1564 |
-
|
| 1565 |
-
alert('โ
์ ์ฒด ์ด๋ฏธ์ง๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์ ์ฅ๋์์ต๋๋ค!');
|
| 1566 |
-
}).catch(function(error) {
|
| 1567 |
-
document.querySelectorAll('.image-number').forEach(label => {
|
| 1568 |
-
label.style.display = 'flex';
|
| 1569 |
-
});
|
| 1570 |
-
loading.classList.remove('active');
|
| 1571 |
-
console.error('Error:', error);
|
| 1572 |
-
alert('โ ๏ธ ์ด๋ฏธ์ง ์ ์ฅ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.');
|
| 1573 |
-
});
|
| 1574 |
-
}
|
| 1575 |
-
|
| 1576 |
// ์บ๋ฒ์ค ํด๋ฆญ ์ด๋ฒคํธ
|
| 1577 |
document.getElementById('canvas').addEventListener('click', function(e) {
|
| 1578 |
if (e.target === this || e.target.classList.contains('webtoon-image')) {
|
|
|
|
| 9 |
|
| 10 |
@app.route('/')
|
| 11 |
def index():
|
| 12 |
+
# HTML_TEMPLATE์ ๊ธฐ๋ณธ ์ด๋ฏธ์ง ์๋ ๋ก๋ ์คํฌ๋ฆฝํธ ์ถ๊ฐ
|
| 13 |
return render_template_string(HTML_TEMPLATE)
|
| 14 |
|
| 15 |
@app.route('/webtoon.png')
|
| 16 |
def serve_webtoon_image():
|
| 17 |
+
# ์ค์ webtoon.png ํ์ผ ์ฒดํฌ
|
| 18 |
+
image_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'webtoon.png')
|
| 19 |
+
|
| 20 |
+
if os.path.exists(image_path):
|
| 21 |
+
return send_file(image_path, mimetype='image/png')
|
| 22 |
+
else:
|
| 23 |
+
# ํ์ผ์ด ์์ผ๋ฉด ์ํ ์ด๋ฏธ์ง ์์ฑ
|
| 24 |
+
from PIL import Image, ImageDraw, ImageFont
|
| 25 |
import io
|
| 26 |
|
| 27 |
+
img = Image.new('RGB', (700, 1000), color='#f0f0f0')
|
| 28 |
+
draw = ImageDraw.Draw(img)
|
| 29 |
+
|
| 30 |
+
# ์ํ ํ
์คํธ ์ถ๊ฐ
|
| 31 |
+
text = "์ํ ์ด๋ฏธ์ง\n(webtoon.png๋ฅผ ์
๋ก๋ํ์ธ์)"
|
| 32 |
+
draw.text((350, 500), text, fill='#999', anchor='mm')
|
| 33 |
|
|
|
|
| 34 |
img_io = io.BytesIO()
|
| 35 |
img.save(img_io, 'PNG')
|
| 36 |
img_io.seek(0)
|
| 37 |
|
| 38 |
return send_file(img_io, mimetype='image/png')
|
|
|
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
|
|
|
|
| 56 |
|
| 57 |
body {
|
| 58 |
font-family: 'Noto Sans KR', sans-serif;
|
| 59 |
+
background: #1a1a1a;
|
| 60 |
+
color: #fff;
|
| 61 |
+
overflow: hidden;
|
| 62 |
}
|
| 63 |
|
| 64 |
.container {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
display: flex;
|
| 66 |
+
height: 100vh;
|
| 67 |
}
|
| 68 |
|
| 69 |
/* ์ข์ธก ํด๋ฐ */
|
|
|
|
| 89 |
}
|
| 90 |
|
| 91 |
.toolbar h2 {
|
| 92 |
+
font-size: 18px;
|
| 93 |
margin-bottom: 20px;
|
| 94 |
color: #fff;
|
| 95 |
border-bottom: 2px solid #4a9eff;
|
| 96 |
padding-bottom: 10px;
|
|
|
|
|
|
|
|
|
|
| 97 |
}
|
| 98 |
|
| 99 |
.tool-section {
|
| 100 |
margin-bottom: 30px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
}
|
| 102 |
|
| 103 |
.tool-section h3 {
|
|
|
|
| 105 |
margin-bottom: 15px;
|
| 106 |
color: #aaa;
|
| 107 |
text-transform: uppercase;
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
/* ํ์ผ ์
๋ก๋ ์์ญ */
|
| 111 |
.file-upload {
|
| 112 |
border: 2px dashed #4a9eff;
|
| 113 |
+
border-radius: 8px;
|
| 114 |
+
padding: 20px;
|
| 115 |
text-align: center;
|
| 116 |
cursor: pointer;
|
| 117 |
transition: all 0.3s;
|
| 118 |
margin-bottom: 20px;
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
.file-upload:hover {
|
| 122 |
+
background: rgba(74, 158, 255, 0.1);
|
| 123 |
border-color: #6ab7ff;
|
|
|
|
| 124 |
}
|
| 125 |
|
| 126 |
.file-upload input {
|
| 127 |
display: none;
|
| 128 |
}
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
/* ํ์ผ ๋ฆฌ์คํธ */
|
| 131 |
.file-list {
|
| 132 |
background: #333;
|
|
|
|
| 140 |
.file-item {
|
| 141 |
font-size: 12px;
|
| 142 |
color: #aaa;
|
| 143 |
+
padding: 3px 0;
|
| 144 |
border-bottom: 1px solid #444;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
}
|
| 146 |
|
| 147 |
.file-item:last-child {
|
|
|
|
| 152 |
.component-grid {
|
| 153 |
display: grid;
|
| 154 |
grid-template-columns: repeat(3, 1fr);
|
| 155 |
+
gap: 8px;
|
| 156 |
}
|
| 157 |
|
| 158 |
.component-btn {
|
| 159 |
+
background: #3a3a3a;
|
| 160 |
border: 1px solid #555;
|
| 161 |
+
border-radius: 8px;
|
| 162 |
+
padding: 10px;
|
| 163 |
cursor: pointer;
|
| 164 |
transition: all 0.3s;
|
| 165 |
text-align: center;
|
| 166 |
color: #fff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
.component-btn:hover {
|
| 170 |
+
background: #4a4a4a;
|
| 171 |
border-color: #4a9eff;
|
| 172 |
+
transform: translateY(-2px);
|
|
|
|
| 173 |
}
|
| 174 |
|
| 175 |
.component-btn svg {
|
| 176 |
+
width: 35px;
|
| 177 |
+
height: 35px;
|
| 178 |
+
margin-bottom: 3px;
|
|
|
|
|
|
|
| 179 |
}
|
| 180 |
|
| 181 |
.component-btn span {
|
| 182 |
display: block;
|
| 183 |
font-size: 11px;
|
|
|
|
|
|
|
| 184 |
}
|
| 185 |
|
| 186 |
/* ์์ฑ ํธ์ง ํจ๋ */
|
| 187 |
.properties-panel {
|
| 188 |
+
background: #333;
|
| 189 |
+
border-radius: 8px;
|
| 190 |
padding: 15px;
|
| 191 |
margin-top: 20px;
|
|
|
|
| 192 |
}
|
| 193 |
|
| 194 |
.property-group {
|
|
|
|
| 199 |
display: block;
|
| 200 |
font-size: 12px;
|
| 201 |
color: #aaa;
|
| 202 |
+
margin-bottom: 5px;
|
|
|
|
|
|
|
| 203 |
}
|
| 204 |
|
| 205 |
.property-group input,
|
| 206 |
.property-group select,
|
| 207 |
.property-group textarea {
|
| 208 |
width: 100%;
|
| 209 |
+
padding: 8px;
|
| 210 |
background: #2a2a2a;
|
| 211 |
border: 1px solid #444;
|
| 212 |
+
border-radius: 4px;
|
| 213 |
color: #fff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
}
|
| 215 |
|
| 216 |
.color-picker {
|
| 217 |
display: grid;
|
| 218 |
grid-template-columns: repeat(6, 1fr);
|
| 219 |
+
gap: 5px;
|
| 220 |
}
|
| 221 |
|
| 222 |
.color-option {
|
| 223 |
width: 35px;
|
| 224 |
height: 35px;
|
| 225 |
+
border-radius: 4px;
|
| 226 |
cursor: pointer;
|
| 227 |
border: 2px solid transparent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
}
|
| 229 |
|
| 230 |
.color-option.selected {
|
| 231 |
border-color: #4a9eff;
|
| 232 |
+
box-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
|
|
|
|
| 233 |
}
|
| 234 |
|
| 235 |
/* ๋ฉ์ธ ์์
์์ญ */
|
|
|
|
| 237 |
flex: 1;
|
| 238 |
display: flex;
|
| 239 |
flex-direction: column;
|
| 240 |
+
background: #1a1a1a;
|
| 241 |
}
|
| 242 |
|
| 243 |
.workspace-header {
|
| 244 |
+
background: #2a2a2a;
|
| 245 |
padding: 15px 20px;
|
| 246 |
+
border-bottom: 1px solid #444;
|
| 247 |
display: flex;
|
| 248 |
justify-content: space-between;
|
| 249 |
align-items: center;
|
| 250 |
}
|
| 251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
.workspace-tools {
|
| 253 |
display: flex;
|
| 254 |
gap: 10px;
|
| 255 |
}
|
| 256 |
|
| 257 |
.tool-btn {
|
| 258 |
+
background: #3a3a3a;
|
| 259 |
+
border: 1px solid #555;
|
| 260 |
+
border-radius: 6px;
|
| 261 |
+
padding: 8px 16px;
|
| 262 |
color: #fff;
|
| 263 |
cursor: pointer;
|
| 264 |
transition: all 0.3s;
|
|
|
|
|
|
|
| 265 |
}
|
| 266 |
|
| 267 |
.tool-btn:hover {
|
| 268 |
+
background: #4a4a4a;
|
| 269 |
+
border-color: #4a9eff;
|
|
|
|
| 270 |
}
|
| 271 |
|
| 272 |
.tool-btn.primary {
|
| 273 |
+
background: #4a9eff;
|
| 274 |
+
border-color: #4a9eff;
|
| 275 |
}
|
| 276 |
|
| 277 |
.tool-btn.primary:hover {
|
| 278 |
+
background: #6ab7ff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
}
|
| 280 |
|
| 281 |
/* ์บ๋ฒ์ค ์์ญ */
|
| 282 |
.canvas-container {
|
| 283 |
flex: 1;
|
| 284 |
overflow: auto;
|
| 285 |
+
padding: 20px;
|
| 286 |
display: flex;
|
| 287 |
justify-content: center;
|
| 288 |
+
background: #222;
|
| 289 |
position: relative;
|
| 290 |
}
|
| 291 |
|
| 292 |
.canvas-wrapper {
|
| 293 |
position: relative;
|
| 294 |
background: white;
|
| 295 |
+
box-shadow: 0 10px 40px rgba(0,0,0,0.5);
|
| 296 |
min-height: 800px;
|
| 297 |
width: 700px;
|
|
|
|
|
|
|
| 298 |
}
|
| 299 |
|
| 300 |
/* ์ด๋ฏธ์ง ์ปจํ
์ด๋ */
|
| 301 |
.image-container {
|
| 302 |
position: relative;
|
| 303 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
}
|
| 305 |
|
| 306 |
.image-number {
|
| 307 |
position: absolute;
|
| 308 |
+
left: -40px;
|
| 309 |
top: 10px;
|
| 310 |
+
background: #4a9eff;
|
| 311 |
color: white;
|
| 312 |
+
width: 30px;
|
| 313 |
+
height: 30px;
|
| 314 |
border-radius: 50%;
|
| 315 |
display: flex;
|
| 316 |
align-items: center;
|
|
|
|
| 318 |
font-weight: bold;
|
| 319 |
font-size: 14px;
|
| 320 |
z-index: 10;
|
| 321 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.3);
|
| 322 |
}
|
| 323 |
|
| 324 |
.webtoon-image {
|
|
|
|
| 333 |
cursor: move;
|
| 334 |
user-select: none;
|
| 335 |
z-index: 50;
|
|
|
|
| 336 |
}
|
| 337 |
|
| 338 |
.draggable-component.dragging {
|
| 339 |
z-index: 1000;
|
| 340 |
+
opacity: 0.8;
|
|
|
|
| 341 |
}
|
| 342 |
|
| 343 |
.draggable-component.selected {
|
| 344 |
outline: 2px solid #4a9eff;
|
| 345 |
z-index: 100;
|
|
|
|
| 346 |
}
|
| 347 |
|
| 348 |
.draggable-component .resize-handle {
|
| 349 |
position: absolute;
|
| 350 |
+
width: 10px;
|
| 351 |
+
height: 10px;
|
| 352 |
+
background: #4a9eff;
|
| 353 |
+
border: 1px solid #fff;
|
|
|
|
| 354 |
display: none;
|
|
|
|
| 355 |
}
|
| 356 |
|
| 357 |
.draggable-component.selected .resize-handle {
|
| 358 |
display: block;
|
| 359 |
}
|
| 360 |
|
| 361 |
+
.resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
|
| 362 |
+
.resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
|
| 363 |
+
.resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
|
| 364 |
+
.resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
|
| 365 |
|
| 366 |
/* ๋งํ์ ์คํ์ผ๋ค */
|
| 367 |
.speech-bubble {
|
|
|
|
| 380 |
box-sizing: border-box;
|
| 381 |
}
|
| 382 |
|
| 383 |
+
.speech-bubble .component-text {
|
| 384 |
+
margin-top: 0;
|
| 385 |
+
padding-top: 8px;
|
| 386 |
+
padding-bottom: 8px;
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
.speech-bubble-tail {
|
| 390 |
position: absolute;
|
| 391 |
bottom: -10px;
|
|
|
|
| 425 |
box-sizing: border-box;
|
| 426 |
}
|
| 427 |
|
| 428 |
+
.thought-bubble .component-text {
|
| 429 |
+
margin-top: 0;
|
| 430 |
+
padding-top: 8px;
|
| 431 |
+
padding-bottom: 8px;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
.thought-bubble-dots {
|
| 435 |
position: absolute;
|
| 436 |
bottom: -25px;
|
|
|
|
| 523 |
width: 100%;
|
| 524 |
height: 100%;
|
| 525 |
font-weight: bold;
|
| 526 |
+
text-shadow: 2px 2px 0 white, -2px -2px 0 white, 2px -2px 0 white, -2px 2px 0 white;
|
|
|
|
| 527 |
display: flex;
|
| 528 |
align-items: center;
|
| 529 |
justify-content: center;
|
|
|
|
| 570 |
display: flex;
|
| 571 |
align-items: center;
|
| 572 |
justify-content: center;
|
|
|
|
| 573 |
}
|
| 574 |
|
| 575 |
.gradient-box .component-text {
|
|
|
|
| 602 |
top: 50%;
|
| 603 |
left: 50%;
|
| 604 |
transform: translate(-50%, -50%);
|
| 605 |
+
background: rgba(0,0,0,0.9);
|
| 606 |
+
padding: 30px;
|
| 607 |
+
border-radius: 10px;
|
| 608 |
z-index: 10000;
|
| 609 |
text-align: center;
|
|
|
|
| 610 |
}
|
| 611 |
|
| 612 |
.loading.active {
|
|
|
|
| 614 |
}
|
| 615 |
|
| 616 |
.loading-spinner {
|
| 617 |
+
border: 3px solid #f3f3f3;
|
| 618 |
+
border-top: 3px solid #4a9eff;
|
| 619 |
border-radius: 50%;
|
| 620 |
+
width: 40px;
|
| 621 |
+
height: 40px;
|
| 622 |
animation: spin 1s linear infinite;
|
| 623 |
+
margin: 0 auto 10px;
|
| 624 |
}
|
| 625 |
|
| 626 |
@keyframes spin {
|
|
|
|
| 628 |
100% { transform: rotate(360deg); }
|
| 629 |
}
|
| 630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
/* ์ด๋ฏธ์ง ๊ฐ๊ฒฉ ์กฐ์ */
|
| 632 |
.spacing-control {
|
| 633 |
display: flex;
|
|
|
|
| 637 |
|
| 638 |
.spacing-control input[type="range"] {
|
| 639 |
flex: 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
}
|
| 641 |
|
| 642 |
.spacing-value {
|
| 643 |
width: 50px;
|
| 644 |
text-align: center;
|
|
|
|
|
|
|
| 645 |
}
|
| 646 |
|
| 647 |
/* ๊ฐ๋ณ ์ ์ฅ ์
๋ ฅ */
|
| 648 |
.save-individual {
|
| 649 |
display: flex;
|
| 650 |
+
gap: 5px;
|
| 651 |
margin-top: 10px;
|
| 652 |
}
|
| 653 |
|
| 654 |
.save-individual input {
|
| 655 |
+
width: 60px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 656 |
}
|
| 657 |
|
| 658 |
.save-individual button {
|
| 659 |
flex: 1;
|
| 660 |
+
padding: 5px;
|
| 661 |
+
background: #28a745;
|
| 662 |
border: none;
|
| 663 |
+
border-radius: 4px;
|
| 664 |
color: white;
|
| 665 |
cursor: pointer;
|
|
|
|
|
|
|
| 666 |
}
|
| 667 |
|
| 668 |
.save-individual button:hover {
|
| 669 |
+
background: #5cbf5c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 670 |
}
|
| 671 |
</style>
|
| 672 |
</head>
|
|
|
|
| 674 |
<div class="container">
|
| 675 |
<!-- ์ข์ธก ํด๋ฐ -->
|
| 676 |
<div class="toolbar">
|
| 677 |
+
<h2>๐จ ์นํฐ ํธ์ง ๋๊ตฌ</h2>
|
|
|
|
|
|
|
|
|
|
| 678 |
|
| 679 |
<!-- ํ์ผ ์
๋ก๋ -->
|
| 680 |
<div class="tool-section">
|
| 681 |
<h3>๐ ์ด๋ฏธ์ง ์
๋ก๋</h3>
|
| 682 |
<div class="file-upload" onclick="document.getElementById('fileInput').click()">
|
| 683 |
+
<svg width="40" height="40" fill="#4a9eff">
|
| 684 |
+
<rect x="5" y="10" width="30" height="25" fill="none" stroke="currentColor" stroke-width="2"/>
|
| 685 |
+
<polyline points="15,25 20,20 25,25" fill="none" stroke="currentColor" stroke-width="2"/>
|
| 686 |
+
<line x1="20" y1="20" x2="20" y2="30" stroke="currentColor" stroke-width="2"/>
|
| 687 |
</svg>
|
| 688 |
+
<p>ํด๋ฆญํ์ฌ ์ด๋ฏธ์ง ์ ํ</p>
|
| 689 |
+
<p style="font-size: 11px; color: #888; margin-top: 5px;">ํ์ผ๋ช
๊ธฐ์ค ์๋ ์ ๋ ฌ (1.jpg, 2.jpg...)</p>
|
| 690 |
<input type="file" id="fileInput" multiple accept="image/*">
|
| 691 |
</div>
|
| 692 |
<div id="fileList"></div>
|
|
|
|
| 705 |
<label>๊ฐ๋ณ ์ด๋ฏธ์ง ์ ์ฅ</label>
|
| 706 |
<div class="save-individual">
|
| 707 |
<input type="number" id="imageNumber" placeholder="๋ฒํธ" min="1">
|
| 708 |
+
<button onclick="exportSingleImage()">์ ์ฅ</button>
|
| 709 |
</div>
|
| 710 |
</div>
|
| 711 |
</div>
|
|
|
|
| 749 |
</div>
|
| 750 |
<div class="component-btn" onclick="addComponent('action')">
|
| 751 |
<svg viewBox="0 0 100 100" fill="none" stroke="white" stroke-width="2">
|
| 752 |
+
<text x="50" y="50" text-anchor="middle" font-size="30" fill="white">!</text>
|
| 753 |
</svg>
|
| 754 |
<span>ํจ๊ณผ์</span>
|
| 755 |
</div>
|
|
|
|
| 765 |
</svg>
|
| 766 |
<span>ํ
์คํธ๋ฐ์ค</span>
|
| 767 |
</div>
|
| 768 |
+
<div class="component-btn" onclick="addComponent('transparent')">
|
| 769 |
+
<svg viewBox="0 0 100 100" fill="none" stroke="white" stroke-width="2" stroke-dasharray="5,5">
|
| 770 |
+
<rect x="20" y="30" width="60" height="40"/>
|
| 771 |
+
</svg>
|
| 772 |
+
<span>ํฌ๋ช
๋ฐ์ค</span>
|
| 773 |
+
</div>
|
| 774 |
<div class="component-btn" onclick="addComponent('gradient')">
|
| 775 |
<svg viewBox="0 0 100 100">
|
| 776 |
<defs>
|
|
|
|
| 797 |
<option value="Arial">Arial</option>
|
| 798 |
<option value="Verdana">Verdana</option>
|
| 799 |
<option value="Georgia">Georgia</option>
|
| 800 |
+
<option value="'Times New Roman'">Times New Roman</option>
|
| 801 |
+
<option value="'Courier New'">Courier New</option>
|
| 802 |
<option value="'Comic Sans MS'">Comic Sans MS</option>
|
| 803 |
</optgroup>
|
| 804 |
<optgroup label="ํ๊ธ ํฐํธ">
|
|
|
|
| 860 |
<!-- ๋ฉ์ธ ์์
์์ญ -->
|
| 861 |
<div class="workspace">
|
| 862 |
<div class="workspace-header">
|
| 863 |
+
<h1 style="font-size: 20px;">๐จ ์นํฐ ํธ์ง ์คํ๋์ค Pro</h1>
|
| 864 |
<div class="workspace-tools">
|
| 865 |
+
<button class="tool-btn" onclick="deleteSelected()">๐๏ธ ์ ํ ์ญ์ </button>
|
| 866 |
<button class="tool-btn" onclick="clearAll()">๐ ์ ์ฒด ์ด๊ธฐํ</button>
|
| 867 |
+
<button class="tool-btn primary" onclick="exportSingleImage()">๐พ ์ด๋ฏธ์ง ์ ์ฅ</button>
|
| 868 |
</div>
|
| 869 |
</div>
|
| 870 |
|
| 871 |
<div class="canvas-container">
|
| 872 |
<div class="canvas-wrapper" id="canvas">
|
| 873 |
+
<!-- ์
๋ก๋๋ ์ด๋ฏธ์ง์ ์ปดํฌ๋ํธ๋ค์ด ์ฌ๊ธฐ์ ์ถ๊ฐ๋ฉ๋๋ค -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 874 |
</div>
|
| 875 |
</div>
|
| 876 |
</div>
|
|
|
|
| 893 |
let selectedColor = 'black';
|
| 894 |
let uploadedImages = [];
|
| 895 |
let currentDragElement = null;
|
| 896 |
+
const DEFAULT_FONT_SIZE = 22; // ๊ธฐ๋ณธ ๊ธ์ ํฌ๊ธฐ ์์
|
| 897 |
+
|
| 898 |
+
// ํ์ด์ง ๋ก๋ ์ ๊ธฐ๋ณธ ์ด๋ฏธ์ง ๋ก๋
|
| 899 |
+
window.addEventListener('DOMContentLoaded', function() {
|
| 900 |
+
loadDefaultImage();
|
| 901 |
+
});
|
| 902 |
+
|
| 903 |
+
// ๊ธฐ๋ณธ ์ด๋ฏธ์ง ๋ก๋ ํจ์
|
| 904 |
+
function loadDefaultImage() {
|
| 905 |
+
const canvas = document.getElementById('canvas');
|
| 906 |
+
|
| 907 |
+
// ์ด๋ฏธ์ง ์ปจํ
์ด๋ ์์ฑ
|
| 908 |
+
const container = document.createElement('div');
|
| 909 |
+
container.className = 'image-container';
|
| 910 |
+
container.id = 'image-container-1';
|
| 911 |
+
|
| 912 |
+
// ๋ฒํธ ๋ผ๋ฒจ ์์ฑ
|
| 913 |
+
const numberLabel = document.createElement('div');
|
| 914 |
+
numberLabel.className = 'image-number';
|
| 915 |
+
numberLabel.textContent = '1';
|
| 916 |
+
|
| 917 |
+
// ์ด๋ฏธ์ง ์์ฑ
|
| 918 |
+
const img = document.createElement('img');
|
| 919 |
+
img.src = 'webtoon.png';
|
| 920 |
+
img.className = 'webtoon-image';
|
| 921 |
+
img.alt = 'webtoon.png';
|
| 922 |
+
img.id = 'webtoon-image-1';
|
| 923 |
+
|
| 924 |
+
// ์ด๋ฏธ์ง ๋ก๋ ์๋ฌ ์ฒ๋ฆฌ
|
| 925 |
+
img.onerror = function() {
|
| 926 |
+
console.error('๊ธฐ๋ณธ ์ด๋ฏธ์ง(webtoon.png)๋ฅผ ๋ถ๋ฌ์ฌ ์ ์์ต๋๋ค.');
|
| 927 |
+
// ์๋ฌ ์ ํ์ผ ๋ฆฌ์คํธ์ ๋ฉ์์ง ํ์
|
| 928 |
+
const fileList = document.getElementById('fileList');
|
| 929 |
+
fileList.innerHTML = '<p style="font-size: 12px; color: #ff6b6b;">โ ๏ธ webtoon.png ํ์ผ์ ์ฐพ์ ์ ์์ต๋๋ค.</p>';
|
| 930 |
+
};
|
| 931 |
+
|
| 932 |
+
// ์ด๋ฏธ์ง ๋ก๋ ์ฑ๊ณต ์
|
| 933 |
+
img.onload = function() {
|
| 934 |
+
// ํ์ผ ๋ฆฌ์คํธ ์
๋ฐ์ดํธ
|
| 935 |
+
const fileList = document.getElementById('fileList');
|
| 936 |
+
fileList.innerHTML = '<p style="font-size: 12px; color: #4a9eff; margin-bottom: 10px;">โ
๊ธฐ๋ณธ ์ด๋ฏธ์ง ๋ก๋๋จ</p><div class="file-list"><div class="file-item">1. webtoon.png (๊ธฐ๋ณธ)</div></div>';
|
| 937 |
+
|
| 938 |
+
// uploadedImages ๋ฐฐ์ด์ ์ถ๊ฐ
|
| 939 |
+
uploadedImages.push({
|
| 940 |
+
id: 1,
|
| 941 |
+
name: 'webtoon.png',
|
| 942 |
+
element: img
|
| 943 |
+
});
|
| 944 |
+
|
| 945 |
+
// ์ด๋ฏธ์ง ๊ฐ๊ฒฉ ์ ์ฉ
|
| 946 |
+
updateImageSpacing();
|
| 947 |
+
};
|
| 948 |
+
|
| 949 |
+
container.appendChild(numberLabel);
|
| 950 |
+
container.appendChild(img);
|
| 951 |
+
canvas.appendChild(container);
|
| 952 |
+
}
|
| 953 |
|
| 954 |
// ์์ฐ์ค๋ฌ์ด ์ ๋ ฌ ํจ์
|
| 955 |
function naturalSort(a, b) {
|
|
|
|
| 971 |
// ํ์ผ ์
๋ก๋ ์ฒ๋ฆฌ
|
| 972 |
document.getElementById('fileInput').addEventListener('change', async function(e) {
|
| 973 |
const files = Array.from(e.target.files);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 974 |
files.sort(naturalSort);
|
| 975 |
|
| 976 |
const canvas = document.getElementById('canvas');
|
|
|
|
| 1049 |
});
|
| 1050 |
}
|
| 1051 |
|
| 1052 |
+
// ์ปดํฌ๋ํธ ์ถ๊ฐ (๊ธฐ๋ณธ ํฐํธ ํฌ๊ธฐ ์์ )
|
| 1053 |
function addComponent(type) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1054 |
const canvas = document.getElementById('canvas');
|
| 1055 |
const component = document.createElement('div');
|
| 1056 |
component.className = 'draggable-component';
|
|
|
|
| 1120 |
<textarea class="component-text" placeholder="ํ
์คํธ ์
๋ ฅ..." style="font-size: ${DEFAULT_FONT_SIZE}px;"></textarea>
|
| 1121 |
</div>`;
|
| 1122 |
break;
|
| 1123 |
+
case 'transparent':
|
| 1124 |
+
innerContent = `
|
| 1125 |
+
<div class="transparent-box">
|
| 1126 |
+
<textarea class="component-text" placeholder="ํ
์คํธ ์
๋ ฅ..." style="font-size: ${DEFAULT_FONT_SIZE}px;"></textarea>
|
| 1127 |
+
</div>`;
|
| 1128 |
+
break;
|
| 1129 |
case 'gradient':
|
| 1130 |
innerContent = `
|
| 1131 |
<div class="gradient-box">
|
|
|
|
| 1195 |
isDragging = true;
|
| 1196 |
currentDragElement = component;
|
| 1197 |
|
| 1198 |
+
// ๋๋๊ทธ ์ค ํด๋์ค ์ถ๊ฐ
|
| 1199 |
component.classList.add('dragging');
|
| 1200 |
|
| 1201 |
const canvasRect = document.getElementById('canvas').getBoundingClientRect();
|
|
|
|
| 1221 |
let newX = e.clientX - canvasRect.left - dragOffset.x;
|
| 1222 |
let newY = e.clientY - canvasRect.top - dragOffset.y + containerScrollTop;
|
| 1223 |
|
| 1224 |
+
// ์บ๋ฒ์ค ๋ฒ์ ๋ด๋ก ์ ํ
|
| 1225 |
newX = Math.max(0, Math.min(newX, canvas.offsetWidth - currentDragElement.offsetWidth));
|
| 1226 |
newY = Math.max(0, newY);
|
| 1227 |
|
|
|
|
| 1391 |
tempContainer.style.left = '-9999px';
|
| 1392 |
document.body.appendChild(tempContainer);
|
| 1393 |
|
| 1394 |
+
// html2canvas ์ต์
|
| 1395 |
html2canvas(tempContainer, {
|
| 1396 |
backgroundColor: '#ffffff',
|
| 1397 |
scale: 2,
|
| 1398 |
useCORS: true,
|
| 1399 |
+
logging: false,
|
| 1400 |
+
scrollY: 0,
|
| 1401 |
+
scrollX: 0,
|
| 1402 |
+
windowHeight: tempContainer.scrollHeight,
|
| 1403 |
+
windowWidth: tempContainer.scrollWidth,
|
| 1404 |
+
onclone: function(clonedDoc) {
|
| 1405 |
+
// ํด๋ก ๋ ๋ฌธ์์์ ํ
์คํธ ์์ญ ์คํ์ผ ์กฐ์
|
| 1406 |
+
const textAreas = clonedDoc.querySelectorAll('.component-text');
|
| 1407 |
+
textAreas.forEach(textarea => {
|
| 1408 |
+
textarea.style.paddingTop = '10px';
|
| 1409 |
+
textarea.style.lineHeight = '1.6';
|
| 1410 |
+
textarea.style.overflow = 'visible';
|
| 1411 |
+
});
|
| 1412 |
+
}
|
| 1413 |
}).then(function(canvas) {
|
| 1414 |
const link = document.createElement('a');
|
| 1415 |
link.download = 'webtoon_' + imageNumber + '_' + new Date().getTime() + '.png';
|
|
|
|
| 1432 |
});
|
| 1433 |
}
|
| 1434 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1435 |
// ์บ๋ฒ์ค ํด๋ฆญ ์ด๋ฒคํธ
|
| 1436 |
document.getElementById('canvas').addEventListener('click', function(e) {
|
| 1437 |
if (e.target === this || e.target.classList.contains('webtoon-image')) {
|