@@ -28,24 +28,20 @@ const AXIS_CONSTANTS = {
2828} ;
2929
3030const CubeAxis = ( { flipX, flipY, flipDown} : { flipX : boolean , flipY : boolean , flipDown : boolean } ) => {
31- const { dimArrays, dimNames, dimUnits, dataShape, revY} = useGlobalStore ( useShallow ( state => ( {
31+ const { dimArrays, dimNames, dimUnits, dataShape, revY, isFlat } = useGlobalStore ( useShallow ( state => ( {
3232 dimArrays : state . dimArrays ,
3333 dimNames : state . dimNames ,
3434 dimUnits : state . dimUnits ,
3535 dataShape : state . dataShape ,
36- revY : state . flipY
36+ revY : state . flipY , isFlat : state . isFlat
3737 } ) ) )
3838
3939 const { xRange, yRange, zRange, plotType, timeScale, animProg, zSlice, ySlice, xSlice} = usePlotStore ( useShallow ( state => ( {
40- xRange : state . xRange ,
41- yRange : state . yRange ,
42- zRange : state . zRange ,
43- plotType : state . plotType ,
44- timeScale : state . timeScale ,
45- animProg : state . animProg ,
46- zSlice : state . zSlice ,
47- ySlice : state . ySlice ,
48- xSlice : state . xSlice
40+ xRange : state . xRange , yRange : state . yRange ,
41+ zRange : state . zRange , plotType : state . plotType ,
42+ timeScale : state . timeScale , animProg : state . animProg ,
43+ zSlice : state . zSlice , ySlice : state . ySlice ,
44+ xSlice : state . xSlice ,
4945 } ) ) )
5046
5147 const { hideAxis, hideAxisControls} = useImageExportStore ( useShallow ( state => ( {
@@ -63,6 +59,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
6359 revY ? dimArrays [ 1 ] . slice ( ySlice [ 0 ] , ySlice [ 1 ] ? ySlice [ 1 ] : undefined ) . reverse ( ) : dimArrays [ 1 ] . slice ( ySlice [ 0 ] , ySlice [ 1 ] ? ySlice [ 1 ] : undefined ) ,
6460 dimArrays [ 2 ] . slice ( xSlice [ 0 ] , xSlice [ 1 ] ? xSlice [ 1 ] : undefined ) ,
6561 ]
62+ const cursor = isFlat || plotType === "flat" ? "default" : "pointer"
6663
6764 const [ xResolution , setXResolution ] = useState < number > ( AXIS_CONSTANTS . INITIAL_RESOLUTION )
6865 const [ yResolution , setYResolution ] = useState < number > ( AXIS_CONSTANTS . INITIAL_RESOLUTION )
@@ -156,7 +153,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
156153 material-depthTest = { false }
157154 position = { [ xTitleOffset , - AXIS_CONSTANTS . TITLE_FONT_SIZE_FACTOR * globalScale / 2 , 0 ] }
158155 onClick = { e => setXResolution ( x => Math . min ( x + 1 , AXIS_CONSTANTS . MAX_RESOLUTION ) ) }
159- onPointerEnter = { e => document . body . style . cursor = 'pointer' }
156+ onPointerEnter = { e => document . body . style . cursor = cursor }
160157 onPointerLeave = { e => document . body . style . cursor = 'default' }
161158 >
162159 +
@@ -307,7 +304,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
307304 material-depthTest = { false }
308305 position = { [ 0 , - yTitleOffset , 0 ] }
309306 onClick = { e => setYResolution ( x => Math . max ( x - 1 , AXIS_CONSTANTS . MIN_RESOLUTION ) ) }
310- onPointerEnter = { e => document . body . style . cursor = 'pointer' }
307+ onPointerEnter = { e => document . body . style . cursor = cursor }
311308 onPointerLeave = { e => document . body . style . cursor = 'default' }
312309 >
313310 -
@@ -387,6 +384,8 @@ const FlatAxis = () =>{
387384
388385 const [ xResolution , setXResolution ] = useState < number > ( FLAT_AXIS_CONSTANTS . INITIAL_RESOLUTION )
389386 const [ yResolution , setYResolution ] = useState < number > ( FLAT_AXIS_CONSTANTS . INITIAL_RESOLUTION )
387+
388+ const cursor = isFlat || plotType === "flat" ? "default" : "pointer"
390389
391390 const { axisArrays, axisUnits, axisNames } = useMemo ( ( ) => {
392391
@@ -499,7 +498,7 @@ const FlatAxis = () =>{
499498 material-depthTest = { false }
500499 position = { [ - xTitleOffset , - 0.05 , 0 ] }
501500 onClick = { e => setXResolution ( x => Math . max ( x - 1 , FLAT_AXIS_CONSTANTS . MIN_RESOLUTION ) ) }
502- onPointerEnter = { e => document . body . style . cursor = 'pointer' }
501+ onPointerEnter = { e => document . body . style . cursor = cursor }
503502 onPointerLeave = { e => document . body . style . cursor = 'default' }
504503 >
505504 -
@@ -547,7 +546,7 @@ const FlatAxis = () =>{
547546 material-depthTest = { false }
548547 position = { [ 0.0 , yTitleOffset , 0 ] }
549548 onClick = { e => setYResolution ( x => Math . min ( x + 1 , FLAT_AXIS_CONSTANTS . MAX_RESOLUTION ) ) }
550- onPointerEnter = { e => document . body . style . cursor = 'pointer' }
549+ onPointerEnter = { e => document . body . style . cursor = cursor }
551550 onPointerLeave = { e => document . body . style . cursor = 'default' }
552551 >
553552 +
@@ -562,7 +561,7 @@ const FlatAxis = () =>{
562561 material-depthTest = { false }
563562 position = { [ 0.0 , - yTitleOffset , 0 ] }
564563 onClick = { e => setYResolution ( x => Math . max ( x - 1 , FLAT_AXIS_CONSTANTS . MIN_RESOLUTION ) ) }
565- onPointerEnter = { e => document . body . style . cursor = 'pointer' }
564+ onPointerEnter = { e => document . body . style . cursor = cursor }
566565 onPointerLeave = { e => document . body . style . cursor = 'default' }
567566 >
568567 -
@@ -583,6 +582,9 @@ export const AxisLines = () => {
583582 const { isFlat} = useGlobalStore ( useShallow ( state => ( {
584583 isFlat : state . isFlat
585584 } ) ) )
585+ const { plotType} = usePlotStore ( useShallow ( state => ( {
586+ plotType :state . plotType
587+ } ) ) )
586588 useFrame ( ( { camera} ) => {
587589 const shouldFlipX = Math . abs ( camera . rotation . z ) > Math . PI / 2
588590 if ( flipX !== shouldFlipX ) {
@@ -601,11 +603,11 @@ export const AxisLines = () => {
601603 }
602604
603605 } )
604-
606+ const cond = isFlat || plotType == "flat"
605607 return (
606608 < >
607- { ! isFlat && < CubeAxis flipX = { flipX } flipY = { flipY } flipDown = { flipDown } /> }
608- < FlatAxis />
609+ { ! cond && < CubeAxis flipX = { flipX } flipY = { flipY } flipDown = { flipDown } /> }
610+ { cond && < FlatAxis /> }
609611 </ >
610612 )
611613}
0 commit comments