thibaud frere commited on
Commit
8f47735
·
1 Parent(s): 99af53b

fix svg overflow

Browse files
app/scripts/export-pdf.mjs CHANGED
@@ -124,8 +124,8 @@ async function waitForD3(page, timeoutMs = 20000) {
124
  await page.evaluate(async (timeout) => {
125
  const start = Date.now();
126
  const isReady = () => {
127
- // Prioritize hero banner if present
128
- const hero = document.querySelector('.hero .d3-galaxy') || document.querySelector('.d3-galaxy');
129
  if (hero) {
130
  return !!hero.querySelector('svg circle, svg path, svg rect, svg g');
131
  }
@@ -274,8 +274,8 @@ async function main() {
274
  }
275
  function fixSvg(svg){
276
  if (!svg) return;
277
- // Do not alter banner galaxy SVG sizing; it relies on explicit width/height
278
- try { if (svg.closest && svg.closest('.d3-galaxy')) return; } catch {}
279
  if (isSmallSvg(svg)) { lockSmallSvgSize(svg); return; }
280
  try { svg.removeAttribute('width'); } catch {}
281
  try { svg.removeAttribute('height'); } catch {}
@@ -372,8 +372,8 @@ async function main() {
372
  }
373
  function fixSvg(svg){
374
  if (!svg) return;
375
- // Do not alter banner galaxy SVG sizing; it relies on explicit width/height
376
- try { if (svg.closest && svg.closest('.d3-galaxy')) return; } catch {}
377
  if (isSmallSvg(svg)) { lockSmallSvgSize(svg); return; }
378
  try { svg.removeAttribute('width'); } catch {}
379
  try { svg.removeAttribute('height'); } catch {}
@@ -427,8 +427,8 @@ async function main() {
427
  /* Banner centering & visibility */
428
  .hero .points { mix-blend-mode: normal !important; }
429
  /* Do NOT force a fixed height to avoid clipping in PDF */
430
- .d3-galaxy { width: 100% !important; max-width: 980px !important; margin-left: auto !important; margin-right: auto !important; }
431
- .d3-galaxy svg { width: 100% !important; height: auto !important; }
432
  ` });
433
  } catch {}
434
  await page.pdf({
 
124
  await page.evaluate(async (timeout) => {
125
  const start = Date.now();
126
  const isReady = () => {
127
+ // Prioritize hero banner if present (generic container)
128
+ const hero = document.querySelector('.hero-banner');
129
  if (hero) {
130
  return !!hero.querySelector('svg circle, svg path, svg rect, svg g');
131
  }
 
274
  }
275
  function fixSvg(svg){
276
  if (!svg) return;
277
+ // Do not alter hero banner SVG sizing; it may rely on explicit width/height
278
+ try { if (svg.closest && svg.closest('.hero-banner')) return; } catch {}
279
  if (isSmallSvg(svg)) { lockSmallSvgSize(svg); return; }
280
  try { svg.removeAttribute('width'); } catch {}
281
  try { svg.removeAttribute('height'); } catch {}
 
372
  }
373
  function fixSvg(svg){
374
  if (!svg) return;
375
+ // Do not alter hero banner SVG sizing; it may rely on explicit width/height
376
+ try { if (svg.closest && svg.closest('.hero-banner')) return; } catch {}
377
  if (isSmallSvg(svg)) { lockSmallSvgSize(svg); return; }
378
  try { svg.removeAttribute('width'); } catch {}
379
  try { svg.removeAttribute('height'); } catch {}
 
427
  /* Banner centering & visibility */
428
  .hero .points { mix-blend-mode: normal !important; }
429
  /* Do NOT force a fixed height to avoid clipping in PDF */
430
+ .hero-banner { width: 100% !important; max-width: 980px !important; margin-left: auto !important; margin-right: auto !important; }
431
+ .hero-banner svg { width: 100% !important; height: auto !important; }
432
  ` });
433
  } catch {}
434
  await page.pdf({
app/src/styles/_base.css CHANGED
@@ -2,6 +2,10 @@
2
 
3
  html { font-size: 16px; line-height: 1.6; }
4
 
 
 
 
 
5
  .content-grid main { color: var(--text-color); }
6
  .content-grid main p { margin: 0 0 var(--spacing-3); }
7
 
 
2
 
3
  html { font-size: 16px; line-height: 1.6; }
4
 
5
+ svg {
6
+ overflow: visible;
7
+ }
8
+
9
  .content-grid main { color: var(--text-color); }
10
  .content-grid main p { margin: 0 0 var(--spacing-3); }
11