File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 import Range from " $components/helpers/Range.svelte" ;
2323 import { onMount } from ' svelte' ;
2424 import { HUMAN_ANCHOR_BENCHMARK } from " $utils/agents.js" ;
25+ import { SCATTER_MAX_WIDTH_HEIGHT_RATIO } from " $utils/constants.js" ;
2526
2627 const MODULE_LEVEL_KEYS = new Set ([
2728 " module-level" ,
6465 let windowW;
6566 let rangeW;
6667 let rangeH;
68+ let scatterHeight;
6769
6870 let reduceMotion = false ;
6971
72+ // Calculate max width based on height and ratio constraint
73+ $: maxScatterWidth = scatterHeight ? scatterHeight * SCATTER_MAX_WIDTH_HEIGHT_RATIO : null ;
74+
7075 onMount (() => {
7176 const media = window .matchMedia (' (prefers-reduced-motion: reduce)' );
7277 reduceMotion = media .matches ;
170175
171176< svelte: window bind: innerWidth= {windowW} / >
172177
173- < section id= " scatter" >
178+ < section id= " scatter" bind : clientHeight = {scatterHeight} style : max - width = {maxScatterWidth ? ` ${ maxScatterWidth } px ` : ' none ' } >
174179 < div class = " chart-container" id= " scatterplot" >
175180 {#if (typeof chartScrollIndex === " number" && chartScrollIndex >= 14 ) || chartScrollIndex == " exit" }
176181 < div class = " range-wrapper" bind: offsetWidth= {rangeW} bind: offsetHeight= {rangeH}>
234239 flex- wrap: wrap;
235240 justify- content: center;
236241 align- items: center;
237- margin- bottom : 5rem ;
242+ margin: 0 auto 5rem auto ;
238243 overflow: hidden;
239244 }
240245
You can’t perform that action at this time.
0 commit comments