jhh6576 commited on
Commit
6f2081d
·
verified ·
1 Parent(s): 2f0439a

Update app_enhanced.py

Browse files
Files changed (1) hide show
  1. app_enhanced.py +23 -0
app_enhanced.py CHANGED
@@ -1071,6 +1071,20 @@ class EnhancedComicGenerator:
1071
  async function exportPagesToPNG() {
1072
  const pages = document.querySelectorAll('.comic-page');
1073
  if (pages.length === 0) return alert("No pages found.");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1074
  alert(`Starting export of ${pages.length} page(s).`);
1075
  for (let i = 0; i < pages.length; i++) {
1076
  try {
@@ -1081,6 +1095,15 @@ class EnhancedComicGenerator:
1081
  link.click();
1082
  } catch (err) { alert(`Failed to export page ${i + 1}.`); }
1083
  }
 
 
 
 
 
 
 
 
 
1084
  }
1085
 
1086
  function replacePanelImage() {
 
1071
  async function exportPagesToPNG() {
1072
  const pages = document.querySelectorAll('.comic-page');
1073
  if (pages.length === 0) return alert("No pages found.");
1074
+
1075
+ // 1. FREEZE DIMENSIONS BEFORE EXPORT
1076
+ const bubbles = document.querySelectorAll('.speech-bubble');
1077
+ bubbles.forEach(b => {
1078
+ const rect = b.getBoundingClientRect();
1079
+ // Force explicit dimensions to prevent html2canvas reflow
1080
+ b.style.width = rect.width + 'px';
1081
+ b.style.height = rect.height + 'px';
1082
+ b.style.minWidth = rect.width + 'px';
1083
+ b.style.maxWidth = rect.width + 'px';
1084
+ b.style.minHeight = rect.height + 'px';
1085
+ b.style.maxHeight = rect.height + 'px';
1086
+ });
1087
+
1088
  alert(`Starting export of ${pages.length} page(s).`);
1089
  for (let i = 0; i < pages.length; i++) {
1090
  try {
 
1095
  link.click();
1096
  } catch (err) { alert(`Failed to export page ${i + 1}.`); }
1097
  }
1098
+
1099
+ // 2. UNFREEZE DIMENSIONS (Restore normal behavior)
1100
+ bubbles.forEach(b => {
1101
+ b.style.minWidth = '50px';
1102
+ b.style.minHeight = '30px';
1103
+ b.style.maxWidth = '';
1104
+ b.style.maxHeight = '';
1105
+ // We keep current width/height as user set them
1106
+ });
1107
  }
1108
 
1109
  function replacePanelImage() {