Update app_enhanced.py
Browse files- app_enhanced.py +63 -41
app_enhanced.py
CHANGED
|
@@ -543,36 +543,52 @@ class EnhancedComicGenerator:
|
|
| 543 |
.speech-bubble.selected { outline: 2px dashed #4CAF50; }
|
| 544 |
.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; }
|
| 545 |
|
| 546 |
-
/* <<< FIXED BUBBLE CSS:
|
| 547 |
.speech-bubble.speech {
|
| 548 |
background: var(--bubble-fill-color, white);
|
| 549 |
color: var(--bubble-text-color, #333);
|
| 550 |
border: 2px solid var(--bubble-border-color, #333);
|
| 551 |
-
border-radius:
|
| 552 |
padding: 0;
|
| 553 |
-
--tail-pos: 50%;
|
| 554 |
}
|
| 555 |
|
| 556 |
.speech-bubble.speech:after, .speech-bubble.speech:before {
|
| 557 |
pointer-events: none;
|
| 558 |
}
|
| 559 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 560 |
/* BOTTOM TAIL */
|
| 561 |
.speech-bubble.speech.tail-bottom:after {
|
| 562 |
content: ''; position: absolute; width: 0; height: 0;
|
| 563 |
-
border: 15px
|
| 564 |
-
border-
|
| 565 |
-
border-
|
| 566 |
-
bottom: -
|
|
|
|
| 567 |
transform: translateX(-50%);
|
| 568 |
z-index: 2;
|
| 569 |
}
|
| 570 |
.speech-bubble.speech.tail-bottom:before {
|
| 571 |
content: ''; position: absolute; width: 0; height: 0;
|
| 572 |
-
border: 17px
|
| 573 |
-
border-
|
| 574 |
-
border-
|
| 575 |
-
bottom: -19px;
|
|
|
|
| 576 |
transform: translateX(-50%);
|
| 577 |
z-index: 1;
|
| 578 |
}
|
|
@@ -580,60 +596,66 @@ class EnhancedComicGenerator:
|
|
| 580 |
/* TOP TAIL */
|
| 581 |
.speech-bubble.speech.tail-top:after {
|
| 582 |
content: ''; position: absolute; width: 0; height: 0;
|
| 583 |
-
border: 15px
|
| 584 |
-
border-
|
| 585 |
-
border-
|
| 586 |
-
top: -
|
| 587 |
-
|
|
|
|
| 588 |
z-index: 2;
|
| 589 |
}
|
| 590 |
.speech-bubble.speech.tail-top:before {
|
| 591 |
content: ''; position: absolute; width: 0; height: 0;
|
| 592 |
-
border: 17px
|
| 593 |
-
border-
|
| 594 |
-
border-
|
| 595 |
-
top: -19px;
|
| 596 |
-
|
|
|
|
| 597 |
z-index: 1;
|
| 598 |
}
|
| 599 |
|
| 600 |
/* RIGHT TAIL */
|
| 601 |
.speech-bubble.speech.tail-right:after {
|
| 602 |
content: ''; position: absolute; width: 0; height: 0;
|
| 603 |
-
border: 15px
|
| 604 |
-
border-
|
| 605 |
-
border-
|
| 606 |
-
right: -
|
| 607 |
-
|
|
|
|
| 608 |
z-index: 2;
|
| 609 |
}
|
| 610 |
.speech-bubble.speech.tail-right:before {
|
| 611 |
content: ''; position: absolute; width: 0; height: 0;
|
| 612 |
-
border: 17px
|
| 613 |
-
border-
|
| 614 |
-
border-
|
| 615 |
-
right: -19px;
|
| 616 |
-
|
|
|
|
| 617 |
z-index: 1;
|
| 618 |
}
|
| 619 |
|
| 620 |
/* LEFT TAIL */
|
| 621 |
.speech-bubble.speech.tail-left:after {
|
| 622 |
content: ''; position: absolute; width: 0; height: 0;
|
| 623 |
-
border: 15px
|
| 624 |
-
border-
|
| 625 |
-
border-
|
| 626 |
-
left: -
|
| 627 |
-
|
|
|
|
| 628 |
z-index: 2;
|
| 629 |
}
|
| 630 |
.speech-bubble.speech.tail-left:before {
|
| 631 |
content: ''; position: absolute; width: 0; height: 0;
|
| 632 |
-
border: 17px
|
| 633 |
-
border-
|
| 634 |
-
border-
|
| 635 |
-
left: -19px;
|
| 636 |
-
|
|
|
|
| 637 |
z-index: 1;
|
| 638 |
}
|
| 639 |
|
|
|
|
| 543 |
.speech-bubble.selected { outline: 2px dashed #4CAF50; }
|
| 544 |
.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; }
|
| 545 |
|
| 546 |
+
/* <<< FIXED BUBBLE CSS: NO LEAKING & SOLID SHARK-FIN SHAPE >>> */
|
| 547 |
.speech-bubble.speech {
|
| 548 |
background: var(--bubble-fill-color, white);
|
| 549 |
color: var(--bubble-text-color, #333);
|
| 550 |
border: 2px solid var(--bubble-border-color, #333);
|
| 551 |
+
border-radius: 12px; /* Slightly rounder to match image style */
|
| 552 |
padding: 0;
|
| 553 |
+
--tail-pos: 50%;
|
| 554 |
}
|
| 555 |
|
| 556 |
.speech-bubble.speech:after, .speech-bubble.speech:before {
|
| 557 |
pointer-events: none;
|
| 558 |
}
|
| 559 |
|
| 560 |
+
/*
|
| 561 |
+
FIX LOGIC:
|
| 562 |
+
Border width of bubble is 2px.
|
| 563 |
+
:before (Border color) is positioned at distance X (e.g. -19px).
|
| 564 |
+
:after (Fill color) acts as a mask.
|
| 565 |
+
To prevent leaking, :after must overlap the main bubble border.
|
| 566 |
+
We shift :after 2px "inwards" (e.g. from -15px to -17px) so its base sits
|
| 567 |
+
exactly on top of the border line, hiding it.
|
| 568 |
+
|
| 569 |
+
SHAPE LOGIC:
|
| 570 |
+
Using `border-width: 15px 15px 0 0` creates a Right-Angled Triangle (Shark Fin)
|
| 571 |
+
instead of an arrow, which matches the provided image style better.
|
| 572 |
+
*/
|
| 573 |
+
|
| 574 |
/* BOTTOM TAIL */
|
| 575 |
.speech-bubble.speech.tail-bottom:after {
|
| 576 |
content: ''; position: absolute; width: 0; height: 0;
|
| 577 |
+
border-width: 15px 15px 0 0; /* Shark Fin Shape */
|
| 578 |
+
border-style: solid;
|
| 579 |
+
border-color: var(--bubble-fill-color, white) transparent transparent transparent;
|
| 580 |
+
bottom: -17px; /* 2px overlap to fix leak */
|
| 581 |
+
left: var(--tail-pos);
|
| 582 |
transform: translateX(-50%);
|
| 583 |
z-index: 2;
|
| 584 |
}
|
| 585 |
.speech-bubble.speech.tail-bottom:before {
|
| 586 |
content: ''; position: absolute; width: 0; height: 0;
|
| 587 |
+
border-width: 17px 17px 0 0;
|
| 588 |
+
border-style: solid;
|
| 589 |
+
border-color: var(--bubble-border-color, #333) transparent transparent transparent;
|
| 590 |
+
bottom: -19px;
|
| 591 |
+
left: var(--tail-pos);
|
| 592 |
transform: translateX(-50%);
|
| 593 |
z-index: 1;
|
| 594 |
}
|
|
|
|
| 596 |
/* TOP TAIL */
|
| 597 |
.speech-bubble.speech.tail-top:after {
|
| 598 |
content: ''; position: absolute; width: 0; height: 0;
|
| 599 |
+
border-width: 0 15px 15px 0;
|
| 600 |
+
border-style: solid;
|
| 601 |
+
border-color: transparent var(--bubble-fill-color, white) transparent transparent;
|
| 602 |
+
top: -17px; /* Fix leak */
|
| 603 |
+
left: var(--tail-pos);
|
| 604 |
+
transform: translateX(-50%) rotate(180deg);
|
| 605 |
z-index: 2;
|
| 606 |
}
|
| 607 |
.speech-bubble.speech.tail-top:before {
|
| 608 |
content: ''; position: absolute; width: 0; height: 0;
|
| 609 |
+
border-width: 0 17px 17px 0;
|
| 610 |
+
border-style: solid;
|
| 611 |
+
border-color: transparent var(--bubble-border-color, #333) transparent transparent;
|
| 612 |
+
top: -19px;
|
| 613 |
+
left: var(--tail-pos);
|
| 614 |
+
transform: translateX(-50%) rotate(180deg);
|
| 615 |
z-index: 1;
|
| 616 |
}
|
| 617 |
|
| 618 |
/* RIGHT TAIL */
|
| 619 |
.speech-bubble.speech.tail-right:after {
|
| 620 |
content: ''; position: absolute; width: 0; height: 0;
|
| 621 |
+
border-width: 15px 15px 0 0;
|
| 622 |
+
border-style: solid;
|
| 623 |
+
border-color: var(--bubble-fill-color, white) transparent transparent transparent;
|
| 624 |
+
right: -17px; /* Fix leak */
|
| 625 |
+
top: var(--tail-pos);
|
| 626 |
+
transform: translateY(-50%) rotate(90deg);
|
| 627 |
z-index: 2;
|
| 628 |
}
|
| 629 |
.speech-bubble.speech.tail-right:before {
|
| 630 |
content: ''; position: absolute; width: 0; height: 0;
|
| 631 |
+
border-width: 17px 17px 0 0;
|
| 632 |
+
border-style: solid;
|
| 633 |
+
border-color: var(--bubble-border-color, #333) transparent transparent transparent;
|
| 634 |
+
right: -19px;
|
| 635 |
+
top: var(--tail-pos);
|
| 636 |
+
transform: translateY(-50%) rotate(90deg);
|
| 637 |
z-index: 1;
|
| 638 |
}
|
| 639 |
|
| 640 |
/* LEFT TAIL */
|
| 641 |
.speech-bubble.speech.tail-left:after {
|
| 642 |
content: ''; position: absolute; width: 0; height: 0;
|
| 643 |
+
border-width: 15px 15px 0 0;
|
| 644 |
+
border-style: solid;
|
| 645 |
+
border-color: var(--bubble-fill-color, white) transparent transparent transparent;
|
| 646 |
+
left: -17px; /* Fix leak */
|
| 647 |
+
top: var(--tail-pos);
|
| 648 |
+
transform: translateY(-50%) rotate(-90deg);
|
| 649 |
z-index: 2;
|
| 650 |
}
|
| 651 |
.speech-bubble.speech.tail-left:before {
|
| 652 |
content: ''; position: absolute; width: 0; height: 0;
|
| 653 |
+
border-width: 17px 17px 0 0;
|
| 654 |
+
border-style: solid;
|
| 655 |
+
border-color: var(--bubble-border-color, #333) transparent transparent transparent;
|
| 656 |
+
left: -19px;
|
| 657 |
+
top: var(--tail-pos);
|
| 658 |
+
transform: translateY(-50%) rotate(-90deg);
|
| 659 |
z-index: 1;
|
| 660 |
}
|
| 661 |
|