@@ -69,6 +69,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
6969
7070 const depthRatio = useMemo ( ( ) => dataShape [ 0 ] / dataShape [ 2 ] * timeScale , [ dataShape , timeScale ] ) ;
7171 const shapeRatio = useMemo ( ( ) => dataShape [ 1 ] / dataShape [ 2 ] , [ dataShape ] )
72+ const timeRatio = Math . max ( dataShape [ 0 ] / dataShape [ 2 ] , 2 ) ;
7273
7374 const secondaryColor = useCSSVariable ( '--text-plot' ) //replace with needed variable
7475 const colorHex = useMemo ( ( ) => {
@@ -89,7 +90,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
8990 return new LineSegments2 ( geom , lineMat ) } , [ yRange , shapeRatio , lineMat , globalScale ] )
9091
9192 const zLine = useMemo ( ( ) => {
92- const geom = new LineSegmentsGeometry ( ) . setPositions ( [ 0 , 0 , isPC ? zRange [ 0 ] * globalScale * depthRatio - tickLength / 2 : zRange [ 0 ] - tickLength / 2 , 0 , 0 , isPC ? zRange [ 1 ] * globalScale * depthRatio + tickLength / 2 : zRange [ 1 ] + tickLength / 2 ] ) ;
93+ const geom = new LineSegmentsGeometry ( ) . setPositions ( [ 0 , 0 , isPC ? zRange [ 0 ] * globalScale * depthRatio - tickLength / 2 : ( zRange [ 0 ] * timeRatio - tickLength ) / 2 , 0 , 0 , isPC ? zRange [ 1 ] * globalScale * depthRatio + tickLength / 2 : ( zRange [ 1 ] * timeRatio + tickLength ) / 2 ] ) ;
9394 return new LineSegments2 ( geom , lineMat ) } , [ zRange , depthRatio , isPC , lineMat , globalScale ] )
9495
9596 const tickLine = useMemo ( ( ) => {
@@ -112,7 +113,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
112113 { /* Horizontal Group */ }
113114 < group position = { [ 0 , isPC ? shapeRatio * globalScale * yRange [ 0 ] : shapeRatio * yRange [ 0 ] , 0 ] } >
114115 { /* X Group */ }
115- < group position = { [ 0 , 0 , flipX ? isPC ? zRange [ 0 ] * depthRatio * ( globalScale ) - tickLength / 2 : zRange [ 0 ] - tickLength / 2 : isPC ? zRange [ 1 ] * ( globalScale ) * depthRatio + tickLength / 2 : zRange [ 1 ] + tickLength / 2 ] } rotation = { [ flipDown ? flipX ? - Math . PI / 2 : Math . PI / 2 : 0 , 0 , 0 ] } >
116+ < group position = { [ 0 , 0 , flipX ? isPC ? zRange [ 0 ] * depthRatio * ( globalScale ) - tickLength / 2 : ( zRange [ 0 ] * timeRatio - tickLength ) / 2 : isPC ? zRange [ 1 ] * ( globalScale ) * depthRatio + tickLength / 2 : ( zRange [ 1 ] * timeRatio + tickLength ) / 2 ] } rotation = { [ flipDown ? flipX ? - Math . PI / 2 : Math . PI / 2 : 0 , 0 , 0 ] } >
116117 < primitive key = { 'xLine' } object = { xLine } />
117118 { Array ( xResolution ) . fill ( null ) . map ( ( _val , idx ) => (
118119 ( ( ( xRange [ 0 ] + 1 ) / 2 ) <= ( idx * xDimScale ) / xResolution &&
@@ -182,7 +183,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
182183 ( ( ( zRange [ 0 ] + 1 ) / 2 ) <= ( idx * zDimScale ) / zResolution &&
183184 ( ( zRange [ 1 ] + 1 ) / 2 ) >= ( idx * zDimScale ) / zResolution )
184185 &&
185- < group key = { `zGroup_${ idx } ` } position = { [ 0 , 0 , isPC ? - depthRatio * globalScale + idx * zDimScale / ( zResolution / 2 ) * depthRatio * ( globalScale ) : - 1 + idx * zDimScale / ( zResolution / 2 ) ] } >
186+ < group key = { `zGroup_${ idx } ` } position = { [ 0 , 0 , isPC ? - depthRatio * globalScale + idx * zDimScale / ( zResolution / 2 ) * depthRatio * ( globalScale ) : - 0.5 * timeRatio + idx * zDimScale / ( zResolution / 2 ) * timeRatio / 2 ] } >
186187 < primitive key = { idx } object = { tickLine . clone ( ) } rotation = { [ 0 , flipY ? Math . PI / 2 : - Math . PI / 2 , 0 ] } />
187188 < Text
188189 key = { `textY_${ idx } ` }
@@ -242,7 +243,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
242243 </ group >
243244 </ group >
244245 { /* Vertical Group */ }
245- < group position = { [ flipY ? xRange [ 0 ] * globalScale - tickLength / 2 : xRange [ 1 ] * globalScale + tickLength / 2 , 0 , flipX ? isPC ? zRange [ 0 ] * depthRatio * ( globalScale ) - tickLength / 2 : zRange [ 0 ] - tickLength / 2 : isPC ? zRange [ 1 ] * depthRatio * ( globalScale ) + tickLength / 2 : zRange [ 1 ] + tickLength / 2 ] } >
246+ < group position = { [ flipY ? xRange [ 0 ] * globalScale - tickLength / 2 : xRange [ 1 ] * globalScale + tickLength / 2 , 0 , flipX ? isPC ? zRange [ 0 ] * depthRatio * ( globalScale ) - tickLength / 2 : ( zRange [ 0 ] * timeRatio - tickLength ) / 2 : isPC ? zRange [ 1 ] * depthRatio * ( globalScale ) + tickLength / 2 : ( zRange [ 1 ] * timeRatio + tickLength ) / 2 ] } >
246247 < primitive key = { 'yLine' } object = { yLine } />
247248 { Array ( yResolution ) . fill ( null ) . map ( ( _val , idx ) => (
248249 ( ( ( yRange [ 0 ] + 1 ) / 2 ) <= ( idx * yDimScale ) / yResolution &&
0 commit comments