Skip to content

Commit c51e5f4

Browse files
authored
Merge pull request #431 from EarthyScience/jp/flat-rotate
removed Redundant code
2 parents cd9e398 + 55f1bca commit c51e5f4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/components/plots/AxisLines.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ const AXIS_CONSTANTS = {
2828
};
2929

3030
const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, flipDown: boolean}) =>{
31-
const {dimArrays, dimNames, dimUnits, dataShape, revY, isFlat} = useGlobalStore(useShallow(state => ({
31+
const {dimArrays, dimNames, dimUnits, dataShape, revY} = useGlobalStore(useShallow(state => ({
3232
dimArrays: state.dimArrays,
3333
dimNames: state.dimNames,
3434
dimUnits: state.dimUnits,
3535
dataShape: state.dataShape,
36-
revY: state.flipY, isFlat:state.isFlat
36+
revY: state.flipY,
3737
})))
3838

3939
const {xRange, yRange, zRange, plotType, timeScale, animProg, zSlice, ySlice, xSlice} = usePlotStore(useShallow(state => ({
@@ -59,7 +59,6 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
5959
revY ? dimArrays[1].slice(ySlice[0], ySlice[1] ? ySlice[1] : undefined).reverse() : dimArrays[1].slice(ySlice[0], ySlice[1] ? ySlice[1] : undefined),
6060
dimArrays[2].slice(xSlice[0], xSlice[1] ? xSlice[1] : undefined),
6161
]
62-
const cursor = isFlat || plotType === "flat" ? "default" : "pointer"
6362

6463
const [xResolution, setXResolution] = useState<number>(AXIS_CONSTANTS.INITIAL_RESOLUTION)
6564
const [yResolution, setYResolution] = useState<number>(AXIS_CONSTANTS.INITIAL_RESOLUTION)
@@ -153,7 +152,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
153152
material-depthTest={false}
154153
position={[xTitleOffset, -AXIS_CONSTANTS.TITLE_FONT_SIZE_FACTOR * globalScale / 2, 0]}
155154
onClick={e=>setXResolution(x=> Math.min(x+1,AXIS_CONSTANTS.MAX_RESOLUTION))}
156-
onPointerEnter={e=>document.body.style.cursor = cursor}
155+
onPointerEnter={e=>document.body.style.cursor = 'pointer'}
157156
onPointerLeave={e=>document.body.style.cursor = 'default'}
158157
>
159158
+
@@ -304,7 +303,7 @@ const CubeAxis = ({flipX, flipY, flipDown}: {flipX: boolean, flipY: boolean, fli
304303
material-depthTest={false}
305304
position={[0, -yTitleOffset, 0]}
306305
onClick={e=>setYResolution(x=> Math.max(x-1,AXIS_CONSTANTS.MIN_RESOLUTION))}
307-
onPointerEnter={e=>document.body.style.cursor = cursor}
306+
onPointerEnter={e=>document.body.style.cursor = 'pointer'}
308307
onPointerLeave={e=>document.body.style.cursor = 'default'}
309308
>
310309
-
@@ -384,8 +383,6 @@ const FlatAxis = () =>{
384383

385384
const [xResolution, setXResolution] = useState<number>(FLAT_AXIS_CONSTANTS.INITIAL_RESOLUTION)
386385
const [yResolution, setYResolution] = useState<number>(FLAT_AXIS_CONSTANTS.INITIAL_RESOLUTION)
387-
388-
const cursor = isFlat || plotType === "flat" ? "default" : "pointer"
389386

390387
const { axisArrays, axisUnits, axisNames } = useMemo(() => {
391388

@@ -498,7 +495,7 @@ const FlatAxis = () =>{
498495
material-depthTest={false}
499496
position={[-xTitleOffset, -0.05, 0]}
500497
onClick={e=>setXResolution(x=> Math.max(x-1,FLAT_AXIS_CONSTANTS.MIN_RESOLUTION))}
501-
onPointerEnter={e=>document.body.style.cursor = cursor}
498+
onPointerEnter={e=>document.body.style.cursor = 'pointer'}
502499
onPointerLeave={e=>document.body.style.cursor = 'default'}
503500
>
504501
-
@@ -546,7 +543,7 @@ const FlatAxis = () =>{
546543
material-depthTest={false}
547544
position={[ 0.0, yTitleOffset, 0]}
548545
onClick={e=>setYResolution(x=> Math.min(x+1,FLAT_AXIS_CONSTANTS.MAX_RESOLUTION))}
549-
onPointerEnter={e=>document.body.style.cursor = cursor}
546+
onPointerEnter={e=>document.body.style.cursor = 'pointer'}
550547
onPointerLeave={e=>document.body.style.cursor = 'default'}
551548
>
552549
+
@@ -561,7 +558,7 @@ const FlatAxis = () =>{
561558
material-depthTest={false}
562559
position={[0.0, -yTitleOffset, 0]}
563560
onClick={e=>setYResolution(x=> Math.max(x-1,FLAT_AXIS_CONSTANTS.MIN_RESOLUTION))}
564-
onPointerEnter={e=>document.body.style.cursor = cursor}
561+
onPointerEnter={e=>document.body.style.cursor = 'pointer'}
565562
onPointerLeave={e=>document.body.style.cursor = 'default'}
566563
>
567564
-

0 commit comments

Comments
 (0)