ISSUE-058 - Fixed glitched corner rounding transition bug.

Added fade-in/fade-out transition for interval/leader text data.
This commit is contained in:
Kyle Geib committed 2022-03-04 16:21:14 -05:00
1 parent 1cccc7d094
commit b9e3447ff5
2 files changed
+36 -15

No files matched your search

@@ -159,17 +159,26 @@ export function TimingTowerRow({
<FastestLapGem />
)}
<RowLeftHalf
roundedCornerTop={
(displayMode === BGTimingTowerDisplayMode.FullLeft &&
car.position === 1) ? 5 : 0
}
roundedCornerBottom={
bottomRounded && orMatch(
displayMode,
BGTimingTowerDisplayMode.LeftOnly,
BGTimingTowerDisplayMode.FullLeft,
) ? 5 : undefined
) ? 5 : 0
}
cornerTransitionTime={TRAVEL_DURATION * DDM}
transitionProps={[{
property: "width",
duration: FULL_WIDTH_DURATION * DDM,
}, {
property: "border-top-right-radius",
duration: TRAVEL_DURATION * DDM,
}, {
property: "border-bottom-right-radius",
duration: TRAVEL_DURATION * DDM,
}]}
wide={displayMode === BGTimingTowerDisplayMode.FullLeft}
ref={leftHalfRef}
@@ -212,7 +221,7 @@ export function TimingTowerRow({
<DriverNameContainer
transitionProps={[{
property: "opacity",
duration: 1000,
duration: FULL_WIDTH_DURATION * DDM,
}]}
>
<DriverName visible={displayMode !== BGTimingTowerDisplayMode.FullLeft}>
@@ -257,24 +266,37 @@ export function TimingTowerRow({
</RowLeftHalf>
<RowRightHalf
roundedCornerTop={car.position === 1 ? 5 : undefined}
roundedCornerTop={car.position === 1 ? 5 : 0}
roundedCornerBottom={
bottomRounded && orMatch(
splitsMode,
BGTimingTowerSplitsMode.Leader,
BGTimingTowerSplitsMode.Interval,
) ? 5 : undefined
) ? 5 : 0
}
cornerTransitionTime={TRAVEL_DURATION * DDM}
collapsed={displayMode !== BGTimingTowerDisplayMode.LeftAndRight}
transitionProps={[{
property: "width",
duration: FULL_WIDTH_DURATION * DDM,
}, {
property: "border-top-right-radius",
duration: TRAVEL_DURATION * DDM,
}, {
property: "border-bottom-right-radius",
duration: TRAVEL_DURATION * DDM,
}]}
hugRight={hugRight}
>
<RowRightHalfLayout>
<TimeDiff xScale={xScale} yScale={yScale}>
<TimeDiff
xScale={xScale}
yScale={yScale}
visible={displayMode === BGTimingTowerDisplayMode.LeftAndRight}
transitionProps={[{
property: "opacity",
duration: FULL_WIDTH_DURATION * DDM,
}]}
>
{rightHalfContent}
</TimeDiff>
</RowRightHalfLayout>
@@ -61,15 +61,10 @@ AnimatedRowContainer.displayName = "AnimatedRowContainer";
type RoundedProp = {
roundedCornerTop?: Px,
roundedCornerBottom?: Px,
cornerTransitionTime: Milliseconds,
};
const Rounded = styled.div<RoundedProp>`
${({ roundedCornerTop }) =>
roundedCornerTop && css`border-top-right-radius: ${roundedCornerTop}px;`}
${({ roundedCornerBottom }) =>
roundedCornerBottom && css`border-bottom-right-radius: ${roundedCornerBottom}px;`}
transition: border-top-right-radius ${({ cornerTransitionTime }) => cornerTransitionTime}ms,
border-bottom-right-radius ${({ cornerTransitionTime }) => cornerTransitionTime}ms;
border-top-right-radius: ${({ roundedCornerTop = 0 }) => roundedCornerTop}px;
border-bottom-right-radius: ${({ roundedCornerBottom = 0 }) => roundedCornerBottom}px;
`;
type RowLeftHalfProps = TransitionProps & {
@@ -226,9 +221,10 @@ export const DriverNameContainer = styled.div<TransitionProps>`
`;
DriverNameContainer.displayName = "DriverNameContainer";
type TimeDiffProps = {
type TimeDiffProps = TransitionProps & {
xScale: Fraction,
yScale: Fraction,
visible: boolean,
};
export const TimeDiff = styled.span<TimeDiffProps>`
color: white;
@@ -240,6 +236,9 @@ export const TimeDiff = styled.span<TimeDiffProps>`
font-feature-settings: 'tnum' 1;
transform-origin: top right;
transform: scale(${({ xScale, yScale }) => `${xScale}, ${yScale}`});
opacity: ${({ visible }) => visible ? 1 : 0};
${({ transitionProps }) => commonTransition(transitionProps)}
`;
TimeDiff.displayName = "TimeDiff";