jhh6576 commited on
Commit
bdb845b
·
verified ·
1 Parent(s): 46d7eca

Update app_enhanced.py

Browse files
Files changed (1) hide show
  1. app_enhanced.py +39 -100
app_enhanced.py CHANGED
@@ -73,10 +73,6 @@ INDEX_HTML = '''
73
  <meta charset="UTF-8">
74
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
75
  <title>Movie to Comic Generator</title>
76
- <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
77
- <link rel="preconnect" href="https://fonts.googleapis.com">
78
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
79
- <link href="https://fonts.googleapis.com/css2?family=Bangers&family=Comic+Neue:wght@700&family=Gloria+Hallelujah&family=Lato&display=swap" rel="stylesheet">
80
  <style>
81
  body {
82
  background-color: #fdf6e3;
@@ -542,31 +538,12 @@ class EnhancedComicGenerator:
542
  .panel img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 0.1s ease-out; }
543
  .panel img.pannable { cursor: grab; }
544
  .panel img.panning { cursor: grabbing; }
545
-
546
- /* General Bubble Container */
547
- .speech-bubble {
548
- position: absolute;
549
- display: flex;
550
- justify-content: center;
551
- align-items: center;
552
- width: 150px;
553
- height: 80px;
554
- min-width: 50px;
555
- min-height: 30px;
556
- box-sizing: border-box;
557
- z-index: 10;
558
- cursor: move;
559
- overflow: visible;
560
- font-size: 13px;
561
- font-weight: bold;
562
- text-align: center;
563
- font-family: 'Comic Neue', cursive;
564
- }
565
  .bubble-text { padding: 0.8em; word-wrap: break-word; position: relative; z-index: 5; }
566
  .speech-bubble.selected { outline: 2px dashed #4CAF50; }
567
  .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; }
568
 
569
- /* <<< EXPORT-SAFE CURVED TAIL (NO MASKS) >>> */
570
  .speech-bubble.speech {
571
  --bubble-fill-color: #4ECDC4;
572
  --bubble-text-color: #ffffff;
@@ -576,101 +553,63 @@ class EnhancedComicGenerator:
576
  background: var(--bubble-fill-color);
577
  color: var(--bubble-text-color);
578
  border: 2px solid var(--bubble-border-color);
579
- border-radius: 15px;
580
  padding: 1em;
581
  position: absolute;
582
  }
583
 
584
- /*
585
- We use two pseudo-elements:
586
- :before -> The outer border (Outline)
587
- :after -> The inner color (Fill)
588
- Shape Logic: Round one corner of a square to create the Shark Fin curve.
589
- */
590
-
591
- .speech-bubble.speech:before,
592
- .speech-bubble.speech:after {
593
  content: "";
594
  position: absolute;
595
- width: 20px;
596
- height: 20px;
597
- pointer-events: none;
598
- }
599
-
600
- /* --- BOTTOM TAIL --- */
601
- .speech-bubble.speech.tail-bottom:after {
602
  background: var(--bubble-fill-color);
603
- border-bottom-right-radius: 20px; /* The Curve */
604
- bottom: -13px; /* Overlap slightly to hide gap */
605
- left: var(--tail-pos);
606
- transform: translateX(-50%) rotate(45deg);
607
- z-index: 2; /* On top of border */
608
- }
609
- .speech-bubble.speech.tail-bottom:before {
610
- background: var(--bubble-border-color);
611
- border-bottom-right-radius: 22px;
612
- width: 24px; height: 24px; /* Slightly larger for border effect */
613
- bottom: -16px;
614
- left: var(--tail-pos);
615
- transform: translateX(-50%) rotate(45deg);
616
  z-index: 1;
617
  }
618
 
619
- /* --- TOP TAIL --- */
620
- .speech-bubble.speech.tail-top:after {
621
- background: var(--bubble-fill-color);
622
- border-top-left-radius: 20px;
623
- top: -13px;
624
  left: var(--tail-pos);
625
- transform: translateX(-50%) rotate(45deg);
626
- z-index: 2;
 
627
  }
 
 
628
  .speech-bubble.speech.tail-top:before {
629
- background: var(--bubble-border-color);
630
- border-top-left-radius: 22px;
631
- width: 24px; height: 24px;
632
- top: -16px;
633
  left: var(--tail-pos);
634
- transform: translateX(-50%) rotate(45deg);
635
- z-index: 1;
 
 
 
636
  }
637
 
638
- /* --- RIGHT TAIL --- */
639
- .speech-bubble.speech.tail-right:after {
640
- background: var(--bubble-fill-color);
641
- border-top-right-radius: 20px;
642
- right: -13px;
643
- top: var(--tail-pos);
644
- transform: translateY(-50%) rotate(45deg);
645
- z-index: 2;
646
- }
647
- .speech-bubble.speech.tail-right:before {
648
- background: var(--bubble-border-color);
649
- border-top-right-radius: 22px;
650
- width: 24px; height: 24px;
651
- right: -16px;
652
  top: var(--tail-pos);
653
- transform: translateY(-50%) rotate(45deg);
654
- z-index: 1;
 
 
 
655
  }
656
 
657
- /* --- LEFT TAIL --- */
658
- .speech-bubble.speech.tail-left:after {
659
- background: var(--bubble-fill-color);
660
- border-bottom-left-radius: 20px;
661
- left: -13px;
662
- top: var(--tail-pos);
663
- transform: translateY(-50%) rotate(45deg);
664
- z-index: 2;
665
- }
666
- .speech-bubble.speech.tail-left:before {
667
- background: var(--bubble-border-color);
668
- border-bottom-left-radius: 22px;
669
- width: 24px; height: 24px;
670
- left: -16px;
671
  top: var(--tail-pos);
672
- transform: translateY(-50%) rotate(45deg);
673
- z-index: 1;
 
 
 
674
  }
675
 
676
  .speech-bubble.thought { background: white; border: 2px dashed #555; color: #333; border-radius: 50%; }
 
73
  <meta charset="UTF-8">
74
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
75
  <title>Movie to Comic Generator</title>
 
 
 
 
76
  <style>
77
  body {
78
  background-color: #fdf6e3;
 
538
  .panel img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 0.1s ease-out; }
539
  .panel img.pannable { cursor: grab; }
540
  .panel img.panning { cursor: grabbing; }
541
+ .speech-bubble { position: absolute; display: flex; justify-content: center; align-items: center; width: 150px; height: 80px; min-width: 50px; min-height: 30px; box-sizing: border-box; z-index: 10; cursor: move; overflow: visible; font-size: 13px; font-weight: bold; text-align: center; font-family: 'Comic Neue', cursive; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  .bubble-text { padding: 0.8em; word-wrap: break-word; position: relative; z-index: 5; }
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 "SHARK FIN" TAIL USING BORDER-RADIUS (EXPORT SAFE) >>> */
547
  .speech-bubble.speech {
548
  --bubble-fill-color: #4ECDC4;
549
  --bubble-text-color: #ffffff;
 
553
  background: var(--bubble-fill-color);
554
  color: var(--bubble-text-color);
555
  border: 2px solid var(--bubble-border-color);
556
+ border-radius: 12px;
557
  padding: 1em;
558
  position: absolute;
559
  }
560
 
561
+ .speech-bubble.speech:before {
 
 
 
 
 
 
 
 
562
  content: "";
563
  position: absolute;
564
+ width: 22px; height: 22px;
 
 
 
 
 
 
565
  background: var(--bubble-fill-color);
566
+ /* The Curve Trick: Square with one rounded corner */
567
+ border-bottom-right-radius: 100%;
568
+
569
+ /* Optional border simulation if needed, but flat is safer for exact shape match */
 
 
 
 
 
 
 
 
 
570
  z-index: 1;
571
  }
572
 
573
+ /* BOTTOM TAIL */
574
+ .speech-bubble.speech.tail-bottom:before {
575
+ top: 95%; /* Slight overlap */
 
 
576
  left: var(--tail-pos);
577
+ transform: translateX(-50%) rotate(45deg) skew(15deg);
578
+ border: 2px solid var(--bubble-border-color);
579
+ border-top: 0; border-left: 0;
580
  }
581
+
582
+ /* TOP TAIL */
583
  .speech-bubble.speech.tail-top:before {
584
+ bottom: 95%;
 
 
 
585
  left: var(--tail-pos);
586
+ border-top-left-radius: 100%;
587
+ border-bottom-right-radius: 0;
588
+ transform: translateX(-50%) rotate(45deg) skew(15deg);
589
+ border: 2px solid var(--bubble-border-color);
590
+ border-bottom: 0; border-right: 0;
591
  }
592
 
593
+ /* LEFT TAIL */
594
+ .speech-bubble.speech.tail-left:before {
595
+ right: 95%;
 
 
 
 
 
 
 
 
 
 
 
596
  top: var(--tail-pos);
597
+ border-bottom-left-radius: 100%;
598
+ border-bottom-right-radius: 0;
599
+ transform: translateY(-50%) rotate(45deg) skew(15deg);
600
+ border: 2px solid var(--bubble-border-color);
601
+ border-top: 0; border-right: 0;
602
  }
603
 
604
+ /* RIGHT TAIL */
605
+ .speech-bubble.speech.tail-right:before {
606
+ left: 95%;
 
 
 
 
 
 
 
 
 
 
 
607
  top: var(--tail-pos);
608
+ border-top-right-radius: 100%;
609
+ border-bottom-right-radius: 0;
610
+ transform: translateY(-50%) rotate(45deg) skew(15deg);
611
+ border: 2px solid var(--bubble-border-color);
612
+ border-bottom: 0; border-left: 0;
613
  }
614
 
615
  .speech-bubble.thought { background: white; border: 2px dashed #555; color: #333; border-radius: 50%; }