@@ -65,7 +65,7 @@ export function FixedTicks({
6565 const { camera, size } = useThree ( )
6666 const [ bounds , setBounds ] = useState < ViewportBounds > ( { left : 0 , right : 0 , top : 0 , bottom : 0 } )
6767
68- const initialHeight = useMemo ( ( ) => height , [ ] )
68+ const initialHeight = useMemo ( ( ) => ( window . innerHeight - height - 50 ) , [ ] )
6969 const [ heightRatio , setHeightRatio ] = useState < number > ( 1 )
7070
7171 const xTickCount = 10 ;
@@ -141,7 +141,10 @@ export function FixedTicks({
141141
142142 useEffect ( ( ) => {
143143 if ( height ) {
144- setHeightRatio ( initialHeight / height )
144+ console . log ( height )
145+ const newHeight = ( window . innerHeight - height - 50 )
146+ console . log ( heightRatio )
147+ setHeightRatio ( newHeight / initialHeight )
145148 }
146149 } , [ height ] )
147150 return (
@@ -178,7 +181,7 @@ export function FixedTicks({
178181 { /* Horizontal grid lines */ }
179182 { Array . from ( { length : yTickCount } , ( _ , i ) => {
180183 if ( i === 0 || i === yTickCount - 1 ) return null ; // Skip edges
181- const y = initialBounds . bottom * heightRatio + ( initialBounds . top - initialBounds . bottom ) * ( i / ( yTickCount - 1 ) ) * heightRatio
184+ const y = ( initialBounds . bottom + ( initialBounds . top - initialBounds . bottom ) * ( i / ( yTickCount - 1 ) ) ) * heightRatio
182185 return (
183186 < line key = { `hgrid-${ i } ` } >
184187 < bufferGeometry >
@@ -238,7 +241,7 @@ export function FixedTicks({
238241
239242 { /* Right Edge Ticks */ }
240243 { Array . from ( { length : yTickCount } , ( _ , i ) => {
241- const y = initialBounds . bottom * heightRatio + ( initialBounds . top - initialBounds . bottom ) * ( i / ( yTickCount - 1 ) ) * heightRatio
244+ const y = ( initialBounds . bottom + ( initialBounds . top - initialBounds . bottom ) * ( i / ( yTickCount - 1 ) ) ) * heightRatio
242245 const normY = y / ( initialBounds . top - initialBounds . bottom ) + .5
243246 return (
244247 < group key = { `right-tick-${ i } ` } position = { [ bounds . right , y , 0 ] } >
0 commit comments