Skip to content

Commit

Permalink
Regions
Browse files Browse the repository at this point in the history
  • Loading branch information
wyne committed Mar 19, 2024
1 parent 913f3b6 commit b41774d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/components/Interactions/Slide/Slide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Slide: React.FC<HalfTapProps> = ({
index,
playerId,
}) => {
// Selector setup
//#region Selector setup

const currentGameId = useAppSelector(state => state.settings.currentGameId);
const currentGame = useAppSelector(state => selectGameById(state, currentGameId));
Expand All @@ -34,7 +34,9 @@ const Slide: React.FC<HalfTapProps> = ({
const addendOne = useAppSelector(state => state.settings.addendOne);
const addendTwo = useAppSelector(state => state.settings.addendTwo);

// Power Hold
//#endregion

//#region Power Hold

const powerHoldTime = 400;
const holdDuration = useRef(new Animated.Value(0)).current;
Expand All @@ -45,7 +47,9 @@ const Slide: React.FC<HalfTapProps> = ({
powerHoldRef.current = powerHold;
}, [powerHold]);

// Derivated Animation values
//#endregion

//#region Derivated Animation values

const scale = holdDuration.interpolate({
inputRange: [0, powerHoldTime * .9, powerHoldTime],
Expand Down Expand Up @@ -84,7 +88,9 @@ const Slide: React.FC<HalfTapProps> = ({
clearTimeout(powerHoldTimer);
};

// Gesture handling
//#endregion

//#region Gesture handling

const pan = useRef(new Animated.ValueXY()).current;
const totalOffset = useSharedValue<number | null>(0);
Expand Down Expand Up @@ -132,8 +138,9 @@ const Slide: React.FC<HalfTapProps> = ({
}
};

//#endregion

// Helpers
//#region Helpers

const scoreChangeHandler = (value: number) => {
if (Math.abs(value) == 0) return;
Expand Down Expand Up @@ -173,6 +180,8 @@ const Slide: React.FC<HalfTapProps> = ({
}
);

//#endregion

return (
<>
<Animated.View style={[
Expand All @@ -181,6 +190,8 @@ const Slide: React.FC<HalfTapProps> = ({
scale: scale,
}],
shadowOpacity: glow,
borderColor: 'red',
borderWidth: 5,
},
styles.sliderGlow
]}>
Expand Down

0 comments on commit b41774d

Please sign in to comment.