jhh6576 commited on
Commit
0bb51b1
·
verified ·
1 Parent(s): 3deaa68

Update app_enhanced.py

Browse files
Files changed (1) hide show
  1. 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: ROBUST DIRECTIONAL TAILS >>> */
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: 10px;
552
  padding: 0;
553
- --tail-pos: 50%; /* Default centered */
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 solid transparent;
564
- border-top-color: var(--bubble-fill-color, white);
565
- border-bottom: 0;
566
- bottom: -15px; left: var(--tail-pos);
 
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 solid transparent;
573
- border-top-color: var(--bubble-border-color, #333);
574
- border-bottom: 0;
575
- bottom: -19px; left: var(--tail-pos);
 
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 solid transparent;
584
- border-bottom-color: var(--bubble-fill-color, white);
585
- border-top: 0;
586
- top: -15px; left: var(--tail-pos);
587
- transform: translateX(-50%);
 
588
  z-index: 2;
589
  }
590
  .speech-bubble.speech.tail-top:before {
591
  content: ''; position: absolute; width: 0; height: 0;
592
- border: 17px solid transparent;
593
- border-bottom-color: var(--bubble-border-color, #333);
594
- border-top: 0;
595
- top: -19px; left: var(--tail-pos);
596
- transform: translateX(-50%);
 
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 solid transparent;
604
- border-left-color: var(--bubble-fill-color, white);
605
- border-right: 0;
606
- right: -15px; top: var(--tail-pos);
607
- transform: translateY(-50%);
 
608
  z-index: 2;
609
  }
610
  .speech-bubble.speech.tail-right:before {
611
  content: ''; position: absolute; width: 0; height: 0;
612
- border: 17px solid transparent;
613
- border-left-color: var(--bubble-border-color, #333);
614
- border-right: 0;
615
- right: -19px; top: var(--tail-pos);
616
- transform: translateY(-50%);
 
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 solid transparent;
624
- border-right-color: var(--bubble-fill-color, white);
625
- border-left: 0;
626
- left: -15px; top: var(--tail-pos);
627
- transform: translateY(-50%);
 
628
  z-index: 2;
629
  }
630
  .speech-bubble.speech.tail-left:before {
631
  content: ''; position: absolute; width: 0; height: 0;
632
- border: 17px solid transparent;
633
- border-right-color: var(--bubble-border-color, #333);
634
- border-left: 0;
635
- left: -19px; top: var(--tail-pos);
636
- transform: translateY(-50%);
 
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