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