Update app_enhanced.py
Browse files- app_enhanced.py +55 -50
app_enhanced.py
CHANGED
|
@@ -562,79 +562,83 @@ class EnhancedComicGenerator:
|
|
| 562 |
.speech-bubble.selected { outline: 2px dashed #4CAF50; }
|
| 563 |
.speech-bubble textarea { position: absolute; top: 0; left: 0; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid #4CAF50; background: rgba(255,255,255,0.95); font: inherit; text-align: center; resize: none; padding: 8px; z-index: 102; }
|
| 564 |
|
| 565 |
-
/* <<<
|
| 566 |
.speech-bubble.speech {
|
| 567 |
/* tail dimension */
|
| 568 |
-
--b:
|
| 569 |
-
--h: 1.
|
|
|
|
| 570 |
|
| 571 |
-
/*
|
| 572 |
-
--
|
| 573 |
-
--x: 1.8em; /* tail skew offset */
|
| 574 |
-
--r: 1.2em; /* radius */
|
| 575 |
-
|
| 576 |
-
/* Colors */
|
| 577 |
--c: var(--bubble-fill-color, #4ECDC4);
|
| 578 |
-
color: var(--bubble-text-color, #fff);
|
| 579 |
|
|
|
|
| 580 |
padding: 1em;
|
| 581 |
background: var(--c);
|
| 582 |
-
position: absolute; /*
|
| 583 |
-
|
| 584 |
-
/*
|
| 585 |
-
border-radius: var(--r) var(--r) min(var(--r),100% - var(--p) - var(--b)/2) min(var(--r),var(--p) - var(--b)/2)/var(--r);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
|
| 587 |
-
/* The
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
calc(var(--p) + var(--x)) calc(100% + var(--h)),
|
| 591 |
-
clamp(0%,var(--p) - var(--b)/2,100% - var(--b)) 100%);
|
| 592 |
-
|
| 593 |
-
/* The user's exact border-image logic */
|
| 594 |
-
border-image: conic-gradient(var(--c) 0 0) 0 0 1 0/0 0 var(--h) 0/0 999px var(--h) 999px;
|
| 595 |
}
|
| 596 |
|
| 597 |
/*
|
| 598 |
-
|
| 599 |
-
Since the user's CSS is hardcoded for "Bottom Tail",
|
| 600 |
-
we adapt it for Top/Left/Right by calculating the correct polygon/border-image values
|
| 601 |
-
derived from the same logic.
|
| 602 |
*/
|
| 603 |
|
| 604 |
-
/* BOTTOM (Default)
|
| 605 |
-
.speech-bubble.speech.tail-bottom {
|
|
|
|
|
|
|
|
|
|
| 606 |
|
| 607 |
-
/* TOP TAIL */
|
| 608 |
.speech-bubble.speech.tail-top {
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
border-radius: min(var(--r),var(--p) - var(--b)/2) min(var(--r),100% - var(--p) - var(--b)/2) var(--r) var(--r)/var(--r);
|
| 617 |
}
|
| 618 |
|
| 619 |
-
/* LEFT TAIL */
|
| 620 |
.speech-bubble.speech.tail-left {
|
| 621 |
-
border-image: conic-gradient(var(--c) 0 0) 0 0 0 1 / 0 0 0 var(--h) / 0 999px 999px var(--h);
|
| 622 |
-
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%,
|
| 623 |
-
0 clamp(var(--b), var(--p) + var(--b)/2, 100%),
|
| 624 |
-
calc(0% - var(--h)) calc(var(--p) + var(--x)),
|
| 625 |
-
0 clamp(0%, var(--p) - var(--b)/2, 100% - var(--b)));
|
| 626 |
border-radius: var(--r);
|
| 627 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 628 |
|
| 629 |
-
/* RIGHT TAIL */
|
| 630 |
.speech-bubble.speech.tail-right {
|
| 631 |
-
border-image: conic-gradient(var(--c) 0 0) 0 1 0 0 / 0 var(--h) 0 0 / 0 var(--h) 999px 999px;
|
| 632 |
-
clip-path: polygon(100% 0, 0 0, 0 100%, 100% 100%,
|
| 633 |
-
100% clamp(var(--b), var(--p) + var(--b)/2, 100%),
|
| 634 |
-
calc(100% + var(--h)) calc(var(--p) + var(--x)),
|
| 635 |
-
100% clamp(0%, var(--p) - var(--b)/2, 100% - var(--b)));
|
| 636 |
border-radius: var(--r);
|
| 637 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 638 |
|
| 639 |
.speech-bubble.thought { background: white; border: 2px dashed #555; color: #333; border-radius: 50%; }
|
| 640 |
.speech-bubble.reaction { background: #FFD700; border: 3px solid #E53935; color: #D32F2F; font-weight: 900; text-transform: uppercase; width: 180px; clip-path: polygon(0% 25%, 17% 21%, 17% 0%, 31% 16%, 50% 4%, 69% 16%, 83% 0%, 83% 21%, 100% 25%, 85% 45%, 95% 62%, 82% 79%, 100% 97%, 79% 89%, 60% 98%, 46% 82%, 27% 95%, 15% 78%, 5% 62%, 15% 45%); }
|
|
@@ -1253,6 +1257,7 @@ class EnhancedComicGenerator:
|
|
| 1253 |
</script>
|
| 1254 |
</body>
|
| 1255 |
</html>'''
|
|
|
|
| 1256 |
with open(os.path.join(self.output_dir, 'page.html'), 'w', encoding='utf-8') as f:
|
| 1257 |
f.write(template_html)
|
| 1258 |
print("📄 Template files copied successfully!")
|
|
@@ -1336,4 +1341,4 @@ def frame_file(filename):
|
|
| 1336 |
if __name__ == '__main__':
|
| 1337 |
port = int(os.getenv("PORT", 7860))
|
| 1338 |
print(f"🚀 Starting Enhanced Comic Generator on host 0.0.0.0, port {port}")
|
| 1339 |
-
app.run(debug=False, host='0.0.0.0', port=port)
|
|
|
|
| 562 |
.speech-bubble.selected { outline: 2px dashed #4CAF50; }
|
| 563 |
.speech-bubble textarea { position: absolute; top: 0; left: 0; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid #4CAF50; background: rgba(255,255,255,0.95); font: inherit; text-align: center; resize: none; padding: 8px; z-index: 102; }
|
| 564 |
|
| 565 |
+
/* <<< USER REQUESTED EXACT CSS FOR SHARK FIN TAIL >>> */
|
| 566 |
.speech-bubble.speech {
|
| 567 |
/* tail dimension */
|
| 568 |
+
--b: 3em; /* base */
|
| 569 |
+
--h: 1.8em; /* height */
|
| 570 |
+
--t: .6; /* thickness (from 0 to 1) */
|
| 571 |
|
| 572 |
+
--p: var(--tail-pos, 50%); /* main position */
|
| 573 |
+
--r: 1.2em; /* the radius */
|
|
|
|
|
|
|
|
|
|
|
|
|
| 574 |
--c: var(--bubble-fill-color, #4ECDC4);
|
|
|
|
| 575 |
|
| 576 |
+
color: var(--bubble-text-color, #fff);
|
| 577 |
padding: 1em;
|
| 578 |
background: var(--c);
|
| 579 |
+
position: absolute; /* Changed from relative to absolute for placement */
|
| 580 |
+
|
| 581 |
+
/* Exact radius logic from user */
|
| 582 |
+
border-radius: var(--r) var(--r) min(var(--r),100% - var(--p) - (1 - var(--t))*var(--b)/2) min(var(--r),var(--p) - (1 - var(--t))*var(--b)/2)/var(--r);
|
| 583 |
+
}
|
| 584 |
+
|
| 585 |
+
.speech-bubble.speech:before {
|
| 586 |
+
content: "";
|
| 587 |
+
position: absolute;
|
| 588 |
+
width: var(--b);
|
| 589 |
+
height: var(--h);
|
| 590 |
+
background: inherit;
|
| 591 |
+
border-bottom-left-radius: 100%;
|
| 592 |
+
pointer-events: none;
|
| 593 |
+
z-index: 1;
|
| 594 |
|
| 595 |
+
/* The specific mask requested */
|
| 596 |
+
-webkit-mask: radial-gradient(calc(var(--t)*100%) 105% at 100% 0,#0000 99%,#000 101%);
|
| 597 |
+
mask: radial-gradient(calc(var(--t)*100%) 105% at 100% 0,#0000 99%,#000 101%);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
}
|
| 599 |
|
| 600 |
/*
|
| 601 |
+
DIRECTIONAL LOGIC (Adapting the user's bottom-tail CSS for other sides)
|
|
|
|
|
|
|
|
|
|
| 602 |
*/
|
| 603 |
|
| 604 |
+
/* BOTTOM TAIL (Default) */
|
| 605 |
+
.speech-bubble.speech.tail-bottom:before {
|
| 606 |
+
top: 100%;
|
| 607 |
+
left: clamp(0%,var(--p) - (1 - var(--t))*var(--b)/2,100% - (1 - var(--t))*var(--b));
|
| 608 |
+
}
|
| 609 |
|
| 610 |
+
/* TOP TAIL (Flip vertically) */
|
| 611 |
.speech-bubble.speech.tail-top {
|
| 612 |
+
/* Swap radius logic for top */
|
| 613 |
+
border-radius: min(var(--r),var(--p) - (1 - var(--t))*var(--b)/2) min(var(--r),100% - var(--p) - (1 - var(--t))*var(--b)/2) var(--r) var(--r)/var(--r);
|
| 614 |
+
}
|
| 615 |
+
.speech-bubble.speech.tail-top:before {
|
| 616 |
+
bottom: 100%;
|
| 617 |
+
left: clamp(0%,var(--p) - (1 - var(--t))*var(--b)/2,100% - (1 - var(--t))*var(--b));
|
| 618 |
+
transform: scaleY(-1);
|
|
|
|
| 619 |
}
|
| 620 |
|
| 621 |
+
/* LEFT TAIL (Rotate 90deg) */
|
| 622 |
.speech-bubble.speech.tail-left {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 623 |
border-radius: var(--r);
|
| 624 |
}
|
| 625 |
+
.speech-bubble.speech.tail-left:before {
|
| 626 |
+
right: 100%;
|
| 627 |
+
top: clamp(0%,var(--p) - (1 - var(--t))*var(--b)/2,100% - (1 - var(--t))*var(--b));
|
| 628 |
+
transform: rotate(90deg);
|
| 629 |
+
transform-origin: top right;
|
| 630 |
+
}
|
| 631 |
|
| 632 |
+
/* RIGHT TAIL (Rotate -90deg) */
|
| 633 |
.speech-bubble.speech.tail-right {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
border-radius: var(--r);
|
| 635 |
}
|
| 636 |
+
.speech-bubble.speech.tail-right:before {
|
| 637 |
+
left: 100%;
|
| 638 |
+
top: clamp(0%,var(--p) - (1 - var(--t))*var(--b)/2,100% - (1 - var(--t))*var(--b));
|
| 639 |
+
transform: rotate(-90deg);
|
| 640 |
+
transform-origin: top left;
|
| 641 |
+
}
|
| 642 |
|
| 643 |
.speech-bubble.thought { background: white; border: 2px dashed #555; color: #333; border-radius: 50%; }
|
| 644 |
.speech-bubble.reaction { background: #FFD700; border: 3px solid #E53935; color: #D32F2F; font-weight: 900; text-transform: uppercase; width: 180px; clip-path: polygon(0% 25%, 17% 21%, 17% 0%, 31% 16%, 50% 4%, 69% 16%, 83% 0%, 83% 21%, 100% 25%, 85% 45%, 95% 62%, 82% 79%, 100% 97%, 79% 89%, 60% 98%, 46% 82%, 27% 95%, 15% 78%, 5% 62%, 15% 45%); }
|
|
|
|
| 1257 |
</script>
|
| 1258 |
</body>
|
| 1259 |
</html>'''
|
| 1260 |
+
# --- FIXED INDENTATION ---
|
| 1261 |
with open(os.path.join(self.output_dir, 'page.html'), 'w', encoding='utf-8') as f:
|
| 1262 |
f.write(template_html)
|
| 1263 |
print("📄 Template files copied successfully!")
|
|
|
|
| 1341 |
if __name__ == '__main__':
|
| 1342 |
port = int(os.getenv("PORT", 7860))
|
| 1343 |
print(f"🚀 Starting Enhanced Comic Generator on host 0.0.0.0, port {port}")
|
| 1344 |
+
app.run(debug=False, host='0.0.0.0', port=port)
|