jhh6576 commited on
Commit
0bcd22d
·
verified ·
1 Parent(s): 4a94eb3

Update app_enhanced.py

Browse files
Files changed (1) hide show
  1. app_enhanced.py +50 -47
app_enhanced.py CHANGED
@@ -539,65 +539,66 @@ class EnhancedComicGenerator:
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: 1em; word-wrap: break-word; }
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
- /* <<< MODIFICATION START: New Advanced CSS for 'speech' bubble >>> */
547
  .speech-bubble.speech {
548
- /* Main bubble properties */
549
- color: var(--bubble-text-color, #333);
550
- font-size: 16px;
551
- padding: 0; /* Padding is handled by the bubble-text span now */
552
- border-radius: 1.2em;
553
  background: var(--bubble-fill-color, white);
554
- box-shadow: 0 0 5px rgba(0,0,0,0.2);
 
 
555
  border: none;
 
556
  }
557
 
558
- .speech-bubble.speech::before {
559
- /* This pseudo-element creates the complex tail */
560
- content: "";
561
  position: absolute;
562
- background: inherit; /* Inherits the dynamic color from the parent */
563
-
564
- /* Tail dimensions */
565
- width: 3em; /* base */
566
- height: 1.8em; /* height */
567
-
568
- /* The magic mask that carves the tail shape */
569
- -webkit-mask: radial-gradient(calc(0.6 * 100%) 105% at 100% 0, #0000 99%, #000 101%);
570
- mask: radial-gradient(calc(0.6 * 100%) 105% at 100% 0, #0000 99%, #000 101%);
571
  }
572
 
573
- /* 4-WAY TAIL ROTATION CLASSES */
574
- .speech-bubble.speech.tail-bl::before { /* Bottom-Left */
575
- bottom: -0.9em;
576
- left: 1.5em;
577
- transform-origin: bottom left;
578
- transform: skewX(30deg) rotate(-10deg);
579
- border-bottom-right-radius: 80%;
 
 
580
  }
581
- .speech-bubble.speech.tail-br::before { /* Bottom-Right */
582
- bottom: -0.9em;
583
- right: 1.5em;
584
- transform-origin: bottom right;
585
- transform: skewX(-30deg) rotate(10deg) scaleX(-1);
586
- border-bottom-left-radius: 80%;
 
 
587
  }
588
- .speech-bubble.speech.tail-tr::before { /* Top-Right */
589
- top: -0.9em;
590
- right: 1.5em;
591
- transform-origin: top right;
592
- transform: skewX(30deg) rotate(10deg) scale(-1, -1);
593
- border-top-left-radius: 80%;
 
 
594
  }
595
- .speech-bubble.speech.tail-tl::before { /* Top-Left */
596
- top: -0.9em;
597
- left: 1.5em;
598
- transform-origin: top left;
599
- transform: skewX(-30deg) rotate(-10deg) scaleY(-1);
600
- border-top-right-radius: 80%;
 
 
601
  }
602
  /* <<< MODIFICATION END >>> */
603
 
@@ -809,7 +810,8 @@ class EnhancedComicGenerator:
809
  bubble.dataset.type = type;
810
 
811
  if (type === 'speech') {
812
- bubble.classList.add('tail-bl');
 
813
  bubble.dataset.tailPos = '0';
814
  }
815
  if (type === 'thought') {
@@ -831,6 +833,7 @@ class EnhancedComicGenerator:
831
  currentlySelectedBubble.style.fontFamily = font;
832
  }
833
 
 
834
  function rotateBubbleTail() {
835
  if (!currentlySelectedBubble) { alert("Please select a bubble first."); return; }
836
  if (currentlySelectedBubble.dataset.type !== 'speech') {
@@ -838,7 +841,7 @@ class EnhancedComicGenerator:
838
  return;
839
  }
840
 
841
- const positions = ['tail-bl', 'tail-br', 'tail-tr', 'tail-tl'];
842
  let currentPos = parseInt(currentlySelectedBubble.dataset.tailPos || 0);
843
  currentlySelectedBubble.classList.remove(positions[currentPos]);
844
  let nextPos = (currentPos + 1) % positions.length;
 
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; }
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
+ /* <<< MODIFICATION START: New CSS Triangle Bubble >>> */
547
  .speech-bubble.speech {
 
 
 
 
 
548
  background: var(--bubble-fill-color, white);
549
+ color: var(--bubble-text-color, #333);
550
+ border-radius: .4em;
551
+ padding: 0;
552
  border: none;
553
+ box-shadow: 0 0 5px rgba(0,0,0,0.2);
554
  }
555
 
556
+ .speech-bubble.speech::after {
557
+ content: '';
 
558
  position: absolute;
559
+ width: 0;
560
+ height: 0;
561
+ /* The color is inherited from the parent's fill color */
562
+ border-color: transparent;
563
+ border-style: solid;
 
 
 
 
564
  }
565
 
566
+ /* 4-WAY TAIL ROTATION CLASSES using the CSS Triangle method */
567
+ .speech-bubble.speech.tail-bottom::after {
568
+ bottom: 0;
569
+ left: 50%;
570
+ border-width: 20px;
571
+ border-top-color: var(--bubble-fill-color, white);
572
+ border-bottom: 0;
573
+ margin-left: -20px;
574
+ margin-bottom: -20px;
575
  }
576
+ .speech-bubble.speech.tail-top::after {
577
+ top: 0;
578
+ left: 50%;
579
+ border-width: 20px;
580
+ border-bottom-color: var(--bubble-fill-color, white);
581
+ border-top: 0;
582
+ margin-left: -20px;
583
+ margin-top: -20px;
584
  }
585
+ .speech-bubble.speech.tail-right::after {
586
+ top: 50%;
587
+ right: 0;
588
+ border-width: 20px;
589
+ border-left-color: var(--bubble-fill-color, white);
590
+ border-right: 0;
591
+ margin-top: -20px;
592
+ margin-right: -20px;
593
  }
594
+ .speech-bubble.speech.tail-left::after {
595
+ top: 50%;
596
+ left: 0;
597
+ border-width: 20px;
598
+ border-right-color: var(--bubble-fill-color, white);
599
+ border-left: 0;
600
+ margin-top: -20px;
601
+ margin-left: -20px;
602
  }
603
  /* <<< MODIFICATION END >>> */
604
 
 
810
  bubble.dataset.type = type;
811
 
812
  if (type === 'speech') {
813
+ // <<< MODIFICATION: Set default tail position class >>>
814
+ bubble.classList.add('tail-bottom');
815
  bubble.dataset.tailPos = '0';
816
  }
817
  if (type === 'thought') {
 
833
  currentlySelectedBubble.style.fontFamily = font;
834
  }
835
 
836
+ // <<< MODIFICATION: Updated rotate function for new classes >>>
837
  function rotateBubbleTail() {
838
  if (!currentlySelectedBubble) { alert("Please select a bubble first."); return; }
839
  if (currentlySelectedBubble.dataset.type !== 'speech') {
 
841
  return;
842
  }
843
 
844
+ const positions = ['tail-bottom', 'tail-right', 'tail-top', 'tail-left'];
845
  let currentPos = parseInt(currentlySelectedBubble.dataset.tailPos || 0);
846
  currentlySelectedBubble.classList.remove(positions[currentPos]);
847
  let nextPos = (currentPos + 1) % positions.length;