23 files changed
+768
-262
No files matched your search
@@ -18,6 +18,7 @@
|
||||
"@react-hook/resize-observer": "^1.2.5",
|
||||
"@react-spring/web": "^9.4.1",
|
||||
"@reduxjs/toolkit": "^1.7.1",
|
||||
"@rooks/use-timeout-when": "^4.11.2",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^12.0.0",
|
||||
"@testing-library/user-event": "^13.2.1",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { theme } from "../../../../shared/theme";
|
||||
import { Fraction, Px } from "../../../../types/style";
|
||||
|
||||
import { PositionFlagBox, PositionNumber } from "./styles";
|
||||
@@ -6,10 +7,16 @@ type PositionFlagProps = {
|
||||
size: Px,
|
||||
number: number,
|
||||
numberSizeFraction?: Fraction,
|
||||
color?: string;
|
||||
};
|
||||
export function PositionFlag({ size, number, numberSizeFraction = 0.64 }: PositionFlagProps) {
|
||||
export function PositionFlag({
|
||||
size,
|
||||
number,
|
||||
numberSizeFraction = 0.64,
|
||||
color = theme.colors.positionFlagBG,
|
||||
}: PositionFlagProps) {
|
||||
return (
|
||||
<PositionFlagBox size={size}>
|
||||
<PositionFlagBox size={size} color={color}>
|
||||
<PositionNumber size={size * numberSizeFraction}>
|
||||
{number}
|
||||
</PositionNumber>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Px } from "../../../../types/style";
|
||||
|
||||
type PositionFlagBoxProps = {
|
||||
size: Px,
|
||||
color: string,
|
||||
};
|
||||
export const PositionFlagBox = styled.div<PositionFlagBoxProps>`
|
||||
position: relative;
|
||||
@@ -10,7 +11,7 @@ export const PositionFlagBox = styled.div<PositionFlagBoxProps>`
|
||||
width: ${({ size }) => `${size}px`};
|
||||
|
||||
border-bottom-right-radius: 15%;
|
||||
background-color: #f4f3ee;
|
||||
background-color: ${({ color }) => color};
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
+15
-42
@@ -1,10 +1,9 @@
|
||||
import { useSpring, animated, easings } from "@react-spring/web";
|
||||
import useMeasure from "react-use-measure";
|
||||
import { useSpring } from "@react-spring/web";
|
||||
|
||||
import { AnimatedVenetianBlindsFilter, VenetianBlindsFilter } from "./styles";
|
||||
import { wipeCustomDegClip } from "../../../../utils/styling";
|
||||
import { Corner, Degrees, Fraction, Px } from "../../../../types/style";
|
||||
import { Milliseconds } from "../../../../types/util";
|
||||
import { WipeTransition } from "../WipeTransition";
|
||||
|
||||
type VenetianBlindsTransitionProps = {
|
||||
visible: boolean,
|
||||
@@ -24,7 +23,7 @@ type VenetianBlindsTransitionProps = {
|
||||
opacityDelay?: Milliseconds,
|
||||
spanBlinkDuration?: Milliseconds,
|
||||
};
|
||||
export const VenetianBlindsTransition = (
|
||||
export function VenetianBlindsTransition(
|
||||
{
|
||||
visible,
|
||||
delay = 0,
|
||||
@@ -44,27 +43,7 @@ export const VenetianBlindsTransition = (
|
||||
spanBlinkDuration,
|
||||
children,
|
||||
}: React.PropsWithChildren<VenetianBlindsTransitionProps>,
|
||||
) => {
|
||||
const [childRef, {
|
||||
height: childHeight,
|
||||
width: childWidth,
|
||||
}] = useMeasure();
|
||||
|
||||
const { wipe } = useSpring({
|
||||
wipe: visible ? 1 : 0,
|
||||
config: {
|
||||
duration: wipeDuration,
|
||||
easing: easings.easeInOutQuint,
|
||||
},
|
||||
delay: 0 + delay,
|
||||
});
|
||||
|
||||
const { opacity } = useSpring({
|
||||
opacity: visible ? 1 : opacityStart,
|
||||
config: { duration: opacityDuration },
|
||||
delay: opacityDelay + delay,
|
||||
});
|
||||
|
||||
) {
|
||||
const blindsSpring = useSpring({
|
||||
opacity: visible ? 1 : 0,
|
||||
config: { duration: blindsOpenDuration },
|
||||
@@ -72,21 +51,15 @@ export const VenetianBlindsTransition = (
|
||||
});
|
||||
|
||||
return (
|
||||
<animated.div
|
||||
style={{
|
||||
opacity,
|
||||
clipPath: wipe.to(wipeProgress => {
|
||||
const coordinates = wipeCustomDegClip(
|
||||
childWidth,
|
||||
childHeight,
|
||||
wipeProgress,
|
||||
wipeStartingCorner,
|
||||
wipeAngle,
|
||||
);
|
||||
return `polygon(${coordinates.map(([x, y]) => `${x}px ${y}px`).join(", ")})`;
|
||||
}),
|
||||
}}
|
||||
ref={childRef}
|
||||
<WipeTransition
|
||||
visible={visible}
|
||||
delay={delay}
|
||||
angle={wipeAngle}
|
||||
duration={wipeDuration}
|
||||
startingCorner={wipeStartingCorner}
|
||||
opacityStart={opacityStart}
|
||||
opacityDuration={opacityDuration}
|
||||
opacityDelay={opacityDelay}
|
||||
>
|
||||
<AnimatedVenetianBlindsFilter
|
||||
style={blindsSpring}
|
||||
@@ -117,6 +90,6 @@ export const VenetianBlindsTransition = (
|
||||
>
|
||||
{children}
|
||||
</VenetianBlindsFilter>
|
||||
</animated.div>
|
||||
</WipeTransition>
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import { animated, easings, useSpring } from "@react-spring/web";
|
||||
import useMeasure from "react-use-measure";
|
||||
|
||||
import { Corner, Degrees, Fraction } from "../../../../types/style";
|
||||
import { Milliseconds } from "../../../../types/util";
|
||||
import { wipeCustomDegClip } from "../../../../utils/styling";
|
||||
|
||||
type WipeTransitionProps = {
|
||||
visible: boolean,
|
||||
delay?: Milliseconds,
|
||||
angle: Degrees,
|
||||
duration: Milliseconds,
|
||||
startingCorner: Corner,
|
||||
opacityStart?: Fraction,
|
||||
opacityDuration?: Milliseconds,
|
||||
opacityDelay?: Milliseconds,
|
||||
}
|
||||
|
||||
export function WipeTransition({
|
||||
visible,
|
||||
delay = 0,
|
||||
angle,
|
||||
duration,
|
||||
startingCorner,
|
||||
opacityStart = 1,
|
||||
opacityDuration = duration,
|
||||
opacityDelay = 0,
|
||||
children,
|
||||
}: React.PropsWithChildren<WipeTransitionProps>) {
|
||||
const [childRef, {
|
||||
height: childHeight,
|
||||
width: childWidth,
|
||||
}] = useMeasure();
|
||||
|
||||
const { wipe } = useSpring({
|
||||
wipe: visible ? 1 : 0,
|
||||
config: {
|
||||
duration: duration,
|
||||
easing: easings.easeInOutQuint,
|
||||
},
|
||||
delay: 0 + delay,
|
||||
});
|
||||
|
||||
const { opacity } = useSpring({
|
||||
opacity: visible ? 1 : opacityStart,
|
||||
config: { duration: opacityDuration },
|
||||
delay: opacityDelay + delay,
|
||||
});
|
||||
|
||||
return (
|
||||
<animated.div
|
||||
style={{
|
||||
opacity,
|
||||
clipPath: wipe.to(wipeProgress => {
|
||||
const coordinates = wipeCustomDegClip(
|
||||
childWidth,
|
||||
childHeight,
|
||||
wipeProgress,
|
||||
startingCorner,
|
||||
angle,
|
||||
);
|
||||
return `polygon(${coordinates.map(([x, y]) => `${x}px ${y}px`).join(", ")})`;
|
||||
}),
|
||||
}}
|
||||
ref={childRef}
|
||||
>
|
||||
{children}
|
||||
</animated.div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./WipeTransition";
|
||||
@@ -0,0 +1,24 @@
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
||||
import { theme } from "../../../shared/theme";
|
||||
|
||||
import { TimingBoardLayout } from "./styles";
|
||||
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
||||
import { TimingTower } from "./TimingTower";
|
||||
|
||||
export function TimingBoard() {
|
||||
const { debugDurationMultiplier } = useSelector(workspaceSelector);
|
||||
return (
|
||||
<TimingBoardLayout>
|
||||
<MockupBlock
|
||||
height="73px"
|
||||
width={`${theme.design.timingTower.rowLeftHalfWidthPx}px`}
|
||||
color="black"
|
||||
/>
|
||||
<TimingTower
|
||||
debugDurationMultiplier={debugDurationMultiplier}
|
||||
/>
|
||||
</TimingBoardLayout>
|
||||
);
|
||||
}
|
||||
@@ -3,40 +3,19 @@ import { useSelector } from "react-redux";
|
||||
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
import { eventSelector } from "../../../../features/event/eventSelector";
|
||||
import { theme } from "../../../../shared/theme";
|
||||
import {
|
||||
BGTimingTowerDisplayModes,
|
||||
BGTimingTowerSplitsMode,
|
||||
Car,
|
||||
CarNotice,
|
||||
CarStatus,
|
||||
} from "../../../../types/state";
|
||||
import { CarStatus } from "../../../../types/state";
|
||||
import { Fraction } from "../../../../types/style";
|
||||
import { orMatch } from "../../../../utils/common";
|
||||
import { getCarAtPos, timeDiff } from "../../../../utils/event";
|
||||
import { formatTime } from "../../../../utils/styling";
|
||||
|
||||
import { PositionFlag } from "../../Common/PositionFlag";
|
||||
import { TeamGem } from "../../Common/TeamGem";
|
||||
import { RowsContainer } from "./styles";
|
||||
import { TimingTowerRow } from "./TimingTowerRow";
|
||||
|
||||
import {
|
||||
DriverName,
|
||||
FastestLapGem,
|
||||
AnimatedRowContainer,
|
||||
RowLeftHalf,
|
||||
RowLeftHalfGemContainer,
|
||||
RowLeftHalfLayout,
|
||||
RowRightHalf,
|
||||
RowRightHalfLayout,
|
||||
RowsContainer,
|
||||
TimeDiff,
|
||||
} from "./styles";
|
||||
type TimingTowerProps = {
|
||||
debugDurationMultiplier?: Fraction,
|
||||
};
|
||||
|
||||
|
||||
export function TimingTower() {
|
||||
|
||||
const { lastUpdate, grid, trackLength, leaderGridSpot } = useSelector(eventSelector);
|
||||
const { timingBoard: { timingTower }, timingBoard: { timingTower: { splitsMode } } } = useSelector(
|
||||
export function TimingTower({ debugDurationMultiplier: DDM }: TimingTowerProps) {
|
||||
const { lastUpdate, grid, trackLength } = useSelector(eventSelector);
|
||||
const { timingBoard: { timingTower: { splitsMode, displayMode } } } = useSelector(
|
||||
broadcastGraphicsSelector,
|
||||
);
|
||||
|
||||
@@ -57,102 +36,19 @@ export function TimingTower() {
|
||||
});
|
||||
setRetiredCarsCount(retiredCount);
|
||||
|
||||
setRows(startingGrid.map(car => buildRow(car, startingGrid.length, retiredCount)));
|
||||
}, [lastUpdate, splitsMode]);
|
||||
|
||||
|
||||
const buildRow = (
|
||||
car: Car,
|
||||
startingCarsCount: number,
|
||||
retiredCarsCount: number,
|
||||
) => {
|
||||
const bottomRounded = car.status === CarStatus.Retired ? (
|
||||
car.position === startingCarsCount
|
||||
) : (
|
||||
car.position === startingCarsCount - retiredCarsCount
|
||||
);
|
||||
|
||||
let rightHalfContent = "";
|
||||
let xScale: Fraction = 1.0;
|
||||
let yScale: Fraction = 1.0;
|
||||
|
||||
if (car.position === 1) {
|
||||
rightHalfContent = splitsMode === BGTimingTowerSplitsMode.Leader
|
||||
? "Leader" : splitsMode === BGTimingTowerSplitsMode.Interval
|
||||
? "Interval" : "";
|
||||
} else if (car.status === CarStatus.Retired) {
|
||||
rightHalfContent = "OUT";
|
||||
} else {
|
||||
const deltaCar = getCarAtPos(
|
||||
grid,
|
||||
splitsMode === BGTimingTowerSplitsMode.Leader ? 1 : car.position - 1,
|
||||
);
|
||||
|
||||
const plusLaps = Math.floor((deltaCar.distance - car.distance) / trackLength);
|
||||
|
||||
rightHalfContent =
|
||||
splitsMode === BGTimingTowerSplitsMode.Leader && plusLaps > 0
|
||||
? `+${plusLaps} LAP${plusLaps > 1 ? "S" : ""}`
|
||||
: `+${formatTime(timeDiff(deltaCar.distance, car.distance), 60)}`;
|
||||
|
||||
xScale = rightHalfContent.includes(":") ? 0.75 : 0.9;
|
||||
yScale = rightHalfContent.includes("+") ? 1.1 : 1.0;
|
||||
}
|
||||
|
||||
return (
|
||||
<AnimatedRowContainer
|
||||
setRows(startingGrid.map(car =>
|
||||
<TimingTowerRow
|
||||
key={car.driver.id}
|
||||
retired={car.status === CarStatus.Retired}
|
||||
wide={timingTower.displayMode !== BGTimingTowerDisplayModes.LeftOnly}
|
||||
top={(car.position - 1) * theme.design.timingTower.rowHeightPx}
|
||||
>
|
||||
{car.notices.includes(CarNotice.FastestLap) && (
|
||||
<FastestLapGem />
|
||||
)}
|
||||
<RowLeftHalf
|
||||
roundedCornerBottom={
|
||||
bottomRounded && orMatch(
|
||||
timingTower.displayMode,
|
||||
BGTimingTowerDisplayModes.LeftOnly,
|
||||
BGTimingTowerDisplayModes.FullLeft,
|
||||
) ? 5 : undefined
|
||||
}
|
||||
>
|
||||
<RowLeftHalfLayout>
|
||||
{car.status !== CarStatus.Retired && (
|
||||
<PositionFlag
|
||||
size={32}
|
||||
number={car.position}
|
||||
numberSizeFraction={.6}
|
||||
/>
|
||||
)}
|
||||
<DriverName>
|
||||
{car.driver.initials}
|
||||
</DriverName>
|
||||
</RowLeftHalfLayout>
|
||||
<RowLeftHalfGemContainer>
|
||||
<TeamGem team={car.driver.team.id} height={30} />
|
||||
</RowLeftHalfGemContainer>
|
||||
</RowLeftHalf>
|
||||
<RowRightHalf
|
||||
roundedCornerTop={car.position === 1 ? 5 : undefined}
|
||||
roundedCornerBottom={
|
||||
bottomRounded && orMatch(
|
||||
timingTower.splitsMode,
|
||||
BGTimingTowerSplitsMode.Leader,
|
||||
BGTimingTowerSplitsMode.Interval,
|
||||
) ? 5 : undefined
|
||||
}
|
||||
>
|
||||
<RowRightHalfLayout>
|
||||
<TimeDiff xScale={xScale} yScale={yScale}>
|
||||
{rightHalfContent}
|
||||
</TimeDiff>
|
||||
</RowRightHalfLayout>
|
||||
</RowRightHalf>
|
||||
</AnimatedRowContainer>
|
||||
);
|
||||
};
|
||||
car={car}
|
||||
grid={grid}
|
||||
startingCarsCount={startingGrid.length}
|
||||
retiredCarsCount={retiredCount}
|
||||
splitsMode={splitsMode}
|
||||
displayMode={displayMode}
|
||||
trackLength={trackLength}
|
||||
debugDurationMultiplier={DDM}
|
||||
/>));
|
||||
}, [lastUpdate, splitsMode]);
|
||||
|
||||
return (
|
||||
<RowsContainer
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import useTimeoutWhen from "@rooks/use-timeout-when";
|
||||
import { useSpring } from "@react-spring/web";
|
||||
|
||||
import { theme } from "../../../../shared/theme";
|
||||
import { orMatch } from "../../../../utils/common";
|
||||
import { getCarAtPos, timeDiff } from "../../../../utils/event";
|
||||
import { formatTime, outlineClipPath } from "../../../../utils/styling";
|
||||
|
||||
import { Fraction } from "../../../../types/style";
|
||||
import { Meters, Milliseconds } from "../../../../types/util";
|
||||
import {
|
||||
BGTimingTowerDisplayMode,
|
||||
BGTimingTowerSplitsMode,
|
||||
Car,
|
||||
CarNotice,
|
||||
CarStatus,
|
||||
Grid,
|
||||
} from "../../../../types/state";
|
||||
|
||||
import { PositionFlag } from "../../Common/PositionFlag";
|
||||
import { TeamGem } from "../../Common/TeamGem";
|
||||
import { WipeTransition } from "../../Common/WipeTransition";
|
||||
import {
|
||||
AnimatedRowContainer,
|
||||
DriverName,
|
||||
FastestLapGem,
|
||||
RowLeftHalf,
|
||||
RowLeftHalfPosFlagContainer,
|
||||
RowLeftHalfGemContainer,
|
||||
RowLeftHalfLayout,
|
||||
RowRightHalf,
|
||||
RowRightHalfLayout,
|
||||
TimeDiff,
|
||||
RowLeftHalfPosFlagChangeContainer,
|
||||
AnimatedRowLeftHalfOutline,
|
||||
} from "./styles";
|
||||
import useMeasure from "react-use-measure";
|
||||
|
||||
const WIPE_DELAY: Milliseconds = 3500;
|
||||
const WIPE_DURATION: Milliseconds = 400;
|
||||
const TRAVEL_DURATION: Milliseconds = 750;
|
||||
|
||||
interface TimingTowerRowProps {
|
||||
car: Car;
|
||||
grid: Grid;
|
||||
startingCarsCount: number;
|
||||
retiredCarsCount: number;
|
||||
splitsMode: BGTimingTowerSplitsMode;
|
||||
displayMode: BGTimingTowerDisplayMode;
|
||||
trackLength: Meters;
|
||||
debugDurationMultiplier?: Fraction,
|
||||
}
|
||||
export function TimingTowerRow({
|
||||
car,
|
||||
grid,
|
||||
startingCarsCount,
|
||||
retiredCarsCount,
|
||||
splitsMode,
|
||||
displayMode,
|
||||
trackLength,
|
||||
debugDurationMultiplier: DDM = 1.0,
|
||||
}: TimingTowerRowProps) {
|
||||
const [pastPos, setPastPos] = useState(car.position);
|
||||
const [posChange, setPosChange] = useState(0);
|
||||
|
||||
// Using timeouts and boolean states I can manipulate visiblity of the position
|
||||
// change effects. wipeVisible is true for only 1ms before being switched back off.
|
||||
const [showPosChange, setshowPosChange] = useState(false);
|
||||
const [showOutline, setShowOutline] = useState(false);
|
||||
const [wipeVisible, setWipeVisible] = useState(false);
|
||||
useTimeoutWhen(() => setshowPosChange(false), (WIPE_DELAY + WIPE_DURATION) * DDM, showPosChange);
|
||||
useTimeoutWhen(() => setShowOutline(false), TRAVEL_DURATION * DDM, showOutline);
|
||||
useTimeoutWhen(() => setWipeVisible(false), 1, wipeVisible);
|
||||
|
||||
useEffect(() => {
|
||||
if (car.position !== pastPos) {
|
||||
setPastPos(car.position);
|
||||
setPosChange(pastPos - car.position);
|
||||
setshowPosChange(true);
|
||||
setShowOutline(true);
|
||||
setWipeVisible(true);
|
||||
}
|
||||
}, [car.position]);
|
||||
|
||||
const { outlineClipPathProgress } = useSpring({
|
||||
outlineClipPathProgress: showPosChange ? 1 : 0,
|
||||
config: { duration: 333 * DDM },
|
||||
delay: 0 * DDM,
|
||||
});
|
||||
|
||||
const [leftHalfRef, {
|
||||
height: leftHalfHeight,
|
||||
width: leftHalfWidth,
|
||||
}] = useMeasure();
|
||||
|
||||
const bottomRounded = car.status === CarStatus.Retired ? (
|
||||
car.position === startingCarsCount
|
||||
) : (
|
||||
car.position === startingCarsCount - retiredCarsCount
|
||||
);
|
||||
|
||||
let rightHalfContent = "";
|
||||
let xScale: Fraction = 1.0;
|
||||
let yScale: Fraction = 1.0;
|
||||
|
||||
if (car.position === 1) {
|
||||
rightHalfContent = splitsMode === BGTimingTowerSplitsMode.Leader
|
||||
? "Leader" : splitsMode === BGTimingTowerSplitsMode.Interval
|
||||
? "Interval" : "";
|
||||
} else if (car.status === CarStatus.Retired) {
|
||||
rightHalfContent = "OUT";
|
||||
} else {
|
||||
const deltaCar = getCarAtPos(
|
||||
grid,
|
||||
splitsMode === BGTimingTowerSplitsMode.Leader ? 1 : car.position - 1,
|
||||
);
|
||||
|
||||
const plusLaps = Math.floor((deltaCar.distance - car.distance) / trackLength);
|
||||
|
||||
rightHalfContent =
|
||||
splitsMode === BGTimingTowerSplitsMode.Leader && plusLaps > 0
|
||||
? `+${plusLaps} LAP${plusLaps > 1 ? "S" : ""}`
|
||||
: `+${formatTime(timeDiff(deltaCar.distance, car.distance), 60)}`;
|
||||
|
||||
xScale = rightHalfContent.includes(":") ? 0.75 : 0.9;
|
||||
yScale = rightHalfContent.includes("+") ? 1.1 : 1.0;
|
||||
}
|
||||
|
||||
return (
|
||||
<AnimatedRowContainer
|
||||
key={car.driver.id}
|
||||
retired={car.status === CarStatus.Retired}
|
||||
wide={displayMode !== BGTimingTowerDisplayMode.LeftOnly}
|
||||
top={(car.position - 1) * theme.design.timingTower.rowHeightPx}
|
||||
transitionTime={TRAVEL_DURATION * DDM}
|
||||
>
|
||||
{car.notices.includes(CarNotice.FastestLap) && (
|
||||
<FastestLapGem />
|
||||
)}
|
||||
<RowLeftHalf
|
||||
roundedCornerBottom={
|
||||
bottomRounded && orMatch(
|
||||
displayMode,
|
||||
BGTimingTowerDisplayMode.LeftOnly,
|
||||
BGTimingTowerDisplayMode.FullLeft,
|
||||
) ? 5 : undefined
|
||||
}
|
||||
transitionTime={TRAVEL_DURATION * DDM}
|
||||
ref={leftHalfRef}
|
||||
>
|
||||
<RowLeftHalfLayout>
|
||||
{car.status !== CarStatus.Retired && (
|
||||
<RowLeftHalfPosFlagContainer size={32}>
|
||||
<PositionFlag
|
||||
size={32}
|
||||
number={car.position}
|
||||
numberSizeFraction={.6}
|
||||
/>
|
||||
<RowLeftHalfPosFlagChangeContainer
|
||||
size={32}
|
||||
visible={showPosChange}
|
||||
transitionTime={167 * DDM}
|
||||
>
|
||||
{showPosChange && (
|
||||
<WipeTransition
|
||||
visible={wipeVisible}
|
||||
delay={WIPE_DELAY * DDM}
|
||||
angle={45}
|
||||
duration={WIPE_DURATION * DDM}
|
||||
startingCorner="topLeft"
|
||||
>
|
||||
<PositionFlag
|
||||
size={32}
|
||||
number={car.position}
|
||||
numberSizeFraction={.6}
|
||||
color={posChange > 0
|
||||
? theme.colors.posGainedGreen
|
||||
: theme.colors.posLostRed}
|
||||
/>
|
||||
</WipeTransition>
|
||||
|
||||
)}
|
||||
</RowLeftHalfPosFlagChangeContainer>
|
||||
|
||||
</RowLeftHalfPosFlagContainer>
|
||||
)}
|
||||
<DriverName>
|
||||
{car.driver.initials}
|
||||
</DriverName>
|
||||
</RowLeftHalfLayout>
|
||||
<RowLeftHalfGemContainer>
|
||||
<TeamGem team={car.driver.team.id} height={30} />
|
||||
</RowLeftHalfGemContainer>
|
||||
|
||||
<AnimatedRowLeftHalfOutline
|
||||
open={showOutline}
|
||||
startThickness={1.5}
|
||||
endThickness={1.5}
|
||||
startColor={posChange > 0
|
||||
? theme.colors.posGainedGreen
|
||||
: theme.colors.posLostRed}
|
||||
endColor={posChange > 0
|
||||
? theme.colors.posGainedGreen
|
||||
: theme.colors.posLostRed}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: 333 * DDM,
|
||||
}]}
|
||||
style={{
|
||||
clipPath: outlineClipPathProgress.to(progress => {
|
||||
const coordinates = outlineClipPath(
|
||||
leftHalfWidth,
|
||||
leftHalfHeight,
|
||||
progress,
|
||||
3,
|
||||
3,
|
||||
);
|
||||
return `polygon(${coordinates.map(([x, y]) => `${x}px ${y}px`).join(", ")})`;
|
||||
}),
|
||||
}}
|
||||
/>
|
||||
</RowLeftHalf>
|
||||
|
||||
<RowRightHalf
|
||||
roundedCornerTop={car.position === 1 ? 5 : undefined}
|
||||
roundedCornerBottom={
|
||||
bottomRounded && orMatch(
|
||||
splitsMode,
|
||||
BGTimingTowerSplitsMode.Leader,
|
||||
BGTimingTowerSplitsMode.Interval,
|
||||
) ? 5 : undefined
|
||||
}
|
||||
transitionTime={TRAVEL_DURATION * DDM}
|
||||
>
|
||||
<RowRightHalfLayout>
|
||||
<TimeDiff xScale={xScale} yScale={yScale}>
|
||||
{rightHalfContent}
|
||||
</TimeDiff>
|
||||
</RowRightHalfLayout>
|
||||
</RowRightHalf>
|
||||
</AnimatedRowContainer>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
import styled, { css } from "styled-components";
|
||||
import { animated } from "@react-spring/web";
|
||||
|
||||
import { Fraction, Px } from "../../../../types/style";
|
||||
import { Fraction, Px, TransitionArgs } from "../../../../types/style";
|
||||
import { Milliseconds } from "../../../../types/util";
|
||||
import { commonTransition } from "../../../../utils/styling";
|
||||
|
||||
import fastestLapIcon from "../../../../public/images/icons/fastest-lap.svg";
|
||||
|
||||
|
||||
type OpenProps = {
|
||||
open: boolean,
|
||||
};
|
||||
type TransitionProps = OpenProps & {
|
||||
transitionProps: TransitionArgs[],
|
||||
};
|
||||
|
||||
type RowsContainerProps = {
|
||||
carsToDisplay: number,
|
||||
retiredCarsPresent: boolean,
|
||||
@@ -26,6 +36,7 @@ type AnimatedRowContainerProps = {
|
||||
retired?: boolean,
|
||||
wide?: boolean,
|
||||
top: Px,
|
||||
transitionTime: Milliseconds,
|
||||
};
|
||||
// All the elements in a row should go in here.
|
||||
export const AnimatedRowContainer = animated(styled.div.attrs<AnimatedRowContainerProps>(({
|
||||
@@ -38,7 +49,7 @@ export const AnimatedRowContainer = animated(styled.div.attrs<AnimatedRowContain
|
||||
}))<AnimatedRowContainerProps>`
|
||||
position: absolute;
|
||||
left: 0;
|
||||
transition: top 500ms;
|
||||
transition: top ${({ transitionTime }) => transitionTime}ms;
|
||||
|
||||
width: ${({ wide }) => wide ? 255 : 147}px;
|
||||
height: ${p => p.theme.design.timingTower.rowHeightPx}px; // Future will be animated.
|
||||
@@ -50,12 +61,15 @@ AnimatedRowContainer.displayName = "AnimatedRowContainer";
|
||||
type RoundedProp = {
|
||||
roundedCornerTop?: Px,
|
||||
roundedCornerBottom?: Px,
|
||||
transitionTime: 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 ${({ transitionTime }) => transitionTime}ms,
|
||||
border-bottom-right-radius ${({ transitionTime }) => transitionTime}ms;
|
||||
`;
|
||||
|
||||
export const RowLeftHalf = styled(Rounded)`
|
||||
@@ -70,6 +84,29 @@ export const RowLeftHalf = styled(Rounded)`
|
||||
`;
|
||||
RowLeftHalf.displayName = "RowLeftHalf";
|
||||
|
||||
type AnimatedRowLeftHalfOutlineProps = TransitionProps & {
|
||||
startThickness: Px,
|
||||
endThickness: Px,
|
||||
startColor: string,
|
||||
endColor: string,
|
||||
};
|
||||
export const AnimatedRowLeftHalfOutline = animated(styled(Rounded) <AnimatedRowLeftHalfOutlineProps>`
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
opacity: ${({ open }) => open ? 1 : 0};
|
||||
outline: ${({ open, startThickness, endThickness, startColor, endColor }) => open
|
||||
? `${endThickness}px solid ${endColor}`
|
||||
: `${startThickness}px solid ${startColor}`};
|
||||
outline-offset: ${({ startThickness }) => -startThickness}px;
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)}
|
||||
`);
|
||||
AnimatedRowLeftHalfOutline.displayName = "AnimatedRowLeftHalfOutline";
|
||||
|
||||
export const RowLeftHalfLayout = styled.div`
|
||||
position: relative;
|
||||
width: 100%;
|
||||
@@ -83,6 +120,33 @@ export const RowLeftHalfLayout = styled.div`
|
||||
`;
|
||||
RowLeftHalfLayout.displayName = "RowLeftHalfLayout";
|
||||
|
||||
type RowLeftHalfPosFlagContainerProps = {
|
||||
size: Px,
|
||||
};
|
||||
export const RowLeftHalfPosFlagContainer = styled.div<RowLeftHalfPosFlagContainerProps>`
|
||||
position: relative;
|
||||
height: ${({ size }) => size}px;
|
||||
width: ${({ size }) => size}px;
|
||||
`;
|
||||
RowLeftHalfPosFlagContainer.displayName = "RowLeftHalfPosFlagContainer";
|
||||
|
||||
type RowLeftHalfPosFlagChangeContainerProps = {
|
||||
size: Px,
|
||||
visible: boolean,
|
||||
transitionTime: Milliseconds,
|
||||
};
|
||||
export const RowLeftHalfPosFlagChangeContainer = styled.div<RowLeftHalfPosFlagChangeContainerProps>`
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: ${({ size }) => size}px;
|
||||
width: ${({ size }) => size}px;
|
||||
|
||||
opacity: ${({ visible }) => visible ? 1 : 0};
|
||||
transition: opacity ${({ transitionTime }) => transitionTime}ms;
|
||||
`;
|
||||
RowLeftHalfPosFlagChangeContainer.displayName = "RowLeftHalfPosFlagChangeContainer";
|
||||
|
||||
export const RowLeftHalfGemContainer = styled.div`
|
||||
position: absolute;
|
||||
right: 0;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./TimingBoard";
|
||||
@@ -0,0 +1,10 @@
|
||||
import styled from "styled-components";
|
||||
|
||||
export const TimingBoardLayout = styled.div`
|
||||
position: relative;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
`;
|
||||
+77
-17
@@ -1,33 +1,93 @@
|
||||
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
||||
import { PadBox } from "@bedrock-layout/padbox";
|
||||
import { Split } from "@bedrock-layout/split";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { broadcastDirectorSelector } from "../../../../features/broadcast/director/broadcastDirectorSelector";
|
||||
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
import { setTimingTowerSplitsMode } from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
||||
|
||||
import { refreshRunningOrder } from "../../../../features/event/eventSlice";
|
||||
import { BGTimingTowerSplitsMode } from "../../../../types/state";
|
||||
import { eventSelector } from "../../../../features/event/eventSelector";
|
||||
import { increaseDistance, refreshRunningOrder, setCarStatus } from "../../../../features/event/eventSlice";
|
||||
import { BGTimingTowerSplitsMode, CarStatus } from "../../../../types/state";
|
||||
import { GridSelection } from "../GridSelection";
|
||||
|
||||
import { ClickSpan } from "./styles";
|
||||
|
||||
export function TimingTowerPrototypeControls() {
|
||||
const dispatch = useDispatch();
|
||||
const { selectedCars } = useSelector(broadcastDirectorSelector);
|
||||
const { timingBoard: { timingTower: { splitsMode } } } = useSelector(broadcastGraphicsSelector);
|
||||
const { grid } = useSelector(eventSelector);
|
||||
|
||||
return (
|
||||
<InlineCluster gutter="md">
|
||||
<ClickSpan onClick={() => dispatch(refreshRunningOrder())}>
|
||||
<Split gutter="md">
|
||||
<InlineCluster as={PadBox} padding="md" gutter="md">
|
||||
<ClickSpan onClick={() => dispatch(refreshRunningOrder())}>
|
||||
Refresh Running Order
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
if (splitsMode === BGTimingTowerSplitsMode.Interval) {
|
||||
dispatch(setTimingTowerSplitsMode(BGTimingTowerSplitsMode.Leader));
|
||||
} else {
|
||||
dispatch(setTimingTowerSplitsMode(BGTimingTowerSplitsMode.Interval));
|
||||
}
|
||||
}}
|
||||
>
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
if (splitsMode === BGTimingTowerSplitsMode.Interval) {
|
||||
dispatch(setTimingTowerSplitsMode(BGTimingTowerSplitsMode.Leader));
|
||||
} else {
|
||||
dispatch(setTimingTowerSplitsMode(BGTimingTowerSplitsMode.Interval));
|
||||
}
|
||||
}}
|
||||
>
|
||||
Splits Mode = {BGTimingTowerSplitsMode[splitsMode]}
|
||||
</ClickSpan>
|
||||
</InlineCluster>
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
dispatch(increaseDistance({
|
||||
cars: selectedCars,
|
||||
distance: 200,
|
||||
randomness: 0,
|
||||
usePerformance: false,
|
||||
}));
|
||||
dispatch(refreshRunningOrder());
|
||||
}}
|
||||
>
|
||||
+200m to cars
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
dispatch(increaseDistance({
|
||||
cars: grid,
|
||||
distance: 100,
|
||||
randomness: 0.05,
|
||||
usePerformance: true,
|
||||
}));
|
||||
dispatch(refreshRunningOrder());
|
||||
}}
|
||||
>
|
||||
+100m performance to all
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
dispatch(setCarStatus({
|
||||
cars: selectedCars,
|
||||
status: CarStatus.Retired,
|
||||
}));
|
||||
dispatch(refreshRunningOrder());
|
||||
}}
|
||||
>
|
||||
Retire cars
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
dispatch(setCarStatus({
|
||||
cars: selectedCars,
|
||||
status: CarStatus.Normal,
|
||||
}));
|
||||
dispatch(refreshRunningOrder());
|
||||
}}
|
||||
>
|
||||
Un-retire cars
|
||||
</ClickSpan>
|
||||
</InlineCluster>
|
||||
<PadBox padding="md">
|
||||
<GridSelection />
|
||||
</PadBox>
|
||||
</Split>
|
||||
);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import { AngledFlagPrototypeControls } from "./PrototypingControls/AngledFlagPro
|
||||
import { ChyronContainer } from "../BroadcastGraphics/Chyrons/Container";
|
||||
import { VenetianBlindsWorkspace } from "./CustomWorkSpaces/VenetianBlindsWorkspace";
|
||||
import { VenetianBlindsPrototypeControls } from "./PrototypingControls/VenetianBlindsPrototype";
|
||||
import { TimingTower } from "../BroadcastGraphics/TimingBoard/TimingTower";
|
||||
import { TimingBoard } from "../BroadcastGraphics/TimingBoard";
|
||||
import { TimingTowerPrototypeControls } from "./PrototypingControls/TimingTowerPrototype";
|
||||
|
||||
const WORKSPACE_LIST_WIDTH = 180;
|
||||
@@ -94,9 +94,10 @@ export default function Workspaces() {
|
||||
<Route path="timingBoard" element={
|
||||
<Workspace
|
||||
workspaceId="timingBoard"
|
||||
previewContent={<TimingTower />}
|
||||
previewContent={<TimingBoard />}
|
||||
prototypeControls={<TimingTowerPrototypeControls />}
|
||||
bleedover={500}
|
||||
showAnimationSpeedSelector
|
||||
/>
|
||||
} />
|
||||
<Route path="*" element={<IndexHeading>Unknown Workspace</IndexHeading>} />
|
||||
|
||||
@@ -13,60 +13,70 @@ export const teams: {[id: string]: Team} = {
|
||||
shortName: "Alfa Romeo",
|
||||
fullName: "Alfa Romeo F1 Team ORLEN",
|
||||
nationality: "CHE",
|
||||
performance: 1.007,
|
||||
},
|
||||
alphaTauri: {
|
||||
id: "alphaTauri",
|
||||
shortName: "AlphaTauri",
|
||||
fullName: "Scuderia AlphaTauri",
|
||||
nationality: "ITA",
|
||||
performance: 1.016,
|
||||
},
|
||||
alpine: {
|
||||
id: "alpine",
|
||||
shortName: "Alpine",
|
||||
fullName: "Alpine F1 Team",
|
||||
nationality: "FRA",
|
||||
performance: 1.014,
|
||||
},
|
||||
astonMartin: {
|
||||
id: "astonMartin",
|
||||
shortName: "Aston Martin",
|
||||
fullName: "Aston Martin Cognizant Formula One Team",
|
||||
nationality: "GBR",
|
||||
performance: 1.012,
|
||||
},
|
||||
ferrari: {
|
||||
id: "ferrari",
|
||||
shortName: "Ferrari",
|
||||
fullName: "Scuderia Ferrari",
|
||||
nationality: "ITA",
|
||||
performance: 1.021,
|
||||
},
|
||||
haas: {
|
||||
id: "haas",
|
||||
shortName: "Haas F1 Team",
|
||||
fullName: "Uralkali Haas F1 Team",
|
||||
nationality: "USA",
|
||||
performance: 1.000,
|
||||
},
|
||||
mclaren: {
|
||||
id: "mclaren",
|
||||
shortName: "McLaren",
|
||||
fullName: "McLaren F1 Team",
|
||||
nationality: "GBR",
|
||||
performance: 1.020,
|
||||
},
|
||||
mercedes: {
|
||||
id: "mercedes",
|
||||
shortName: "Mercedes",
|
||||
fullName: "Mercedes-AMG Petronas Formula One Team",
|
||||
nationality: "DEU",
|
||||
performance: 1.025,
|
||||
},
|
||||
redBull: {
|
||||
id: "redBull",
|
||||
shortName: "Red Bull Racing",
|
||||
fullName: "Red Bull Racing",
|
||||
nationality: "AUT",
|
||||
performance: 1.024,
|
||||
},
|
||||
williams: {
|
||||
id: "williams",
|
||||
shortName: "Williams",
|
||||
fullName: "Williams Racing",
|
||||
nationality: "GBR",
|
||||
performance: 1.008,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -84,6 +94,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false, // TBD
|
||||
initials: "ALB",
|
||||
nationality: "THA",
|
||||
performance: 1.000,
|
||||
},
|
||||
alonso: {
|
||||
id: "alonso",
|
||||
@@ -94,6 +105,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "ALO",
|
||||
nationality: "ESP",
|
||||
performance: 1.003,
|
||||
},
|
||||
bottas: {
|
||||
id: "bottas",
|
||||
@@ -104,6 +116,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "BOT",
|
||||
nationality: "FIN",
|
||||
performance: 1.000,
|
||||
},
|
||||
gasly: {
|
||||
id: "gasly",
|
||||
@@ -114,6 +127,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "GAS",
|
||||
nationality: "FRA",
|
||||
performance: 1.020,
|
||||
},
|
||||
giovinazzi: {
|
||||
id: "giovinazzi",
|
||||
@@ -124,6 +138,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "GIO",
|
||||
nationality: "ITA",
|
||||
performance: 1.000,
|
||||
},
|
||||
hamilton: {
|
||||
id: "hamilton",
|
||||
@@ -134,6 +149,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "HAM",
|
||||
nationality: "GBR",
|
||||
performance: 1.010,
|
||||
},
|
||||
kubica: {
|
||||
id: "kubica",
|
||||
@@ -144,6 +160,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "KUB",
|
||||
nationality: "POL",
|
||||
performance: 0.980,
|
||||
},
|
||||
latifi: {
|
||||
id: "latifi",
|
||||
@@ -154,6 +171,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "LAT",
|
||||
nationality: "CAN",
|
||||
performance: 1.000,
|
||||
},
|
||||
leclerc: {
|
||||
id: "leclerc",
|
||||
@@ -164,6 +182,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "LEC",
|
||||
nationality: "MCO",
|
||||
performance: 1.005,
|
||||
},
|
||||
mazepin: {
|
||||
id: "mazepin",
|
||||
@@ -174,6 +193,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "MAZ",
|
||||
nationality: "RAF",
|
||||
performance: 1.000,
|
||||
},
|
||||
norris: {
|
||||
id: "norris",
|
||||
@@ -184,6 +204,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "NOR",
|
||||
nationality: "GBR",
|
||||
performance: 1.009,
|
||||
},
|
||||
ocon: {
|
||||
id: "ocon",
|
||||
@@ -194,6 +215,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "OCO",
|
||||
nationality: "FRA",
|
||||
performance: 1.000,
|
||||
},
|
||||
perez: {
|
||||
id: "perez",
|
||||
@@ -204,6 +226,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "PER",
|
||||
nationality: "MEX",
|
||||
performance: 1.000,
|
||||
},
|
||||
raikkonen: {
|
||||
id: "raikkonen",
|
||||
@@ -214,6 +237,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "RAI",
|
||||
nationality: "FIN",
|
||||
performance: 1.002,
|
||||
},
|
||||
ricciardo: {
|
||||
id: "ricciardo",
|
||||
@@ -224,6 +248,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "RIC",
|
||||
nationality: "AUS",
|
||||
performance: 1.000,
|
||||
},
|
||||
russell: {
|
||||
id: "russell",
|
||||
@@ -234,6 +259,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "RUS",
|
||||
nationality: "GBR",
|
||||
performance: 1.016,
|
||||
},
|
||||
sainz: {
|
||||
id: "sainz",
|
||||
@@ -244,6 +270,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "SAI",
|
||||
nationality: "ESP",
|
||||
performance: 1.000,
|
||||
},
|
||||
schumacher: {
|
||||
id: "schumacher",
|
||||
@@ -254,6 +281,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "MSC",
|
||||
nationality: "DEU",
|
||||
performance: 1.025,
|
||||
},
|
||||
stroll: {
|
||||
id: "stroll",
|
||||
@@ -264,6 +292,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "STR",
|
||||
nationality: "CAN",
|
||||
performance: 1.000,
|
||||
},
|
||||
tsunoda: {
|
||||
id: "tsunoda",
|
||||
@@ -274,6 +303,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "TSU",
|
||||
nationality: "JPN",
|
||||
performance: 1.000,
|
||||
},
|
||||
verstappen: {
|
||||
id: "verstappen",
|
||||
@@ -284,6 +314,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: false,
|
||||
initials: "VER",
|
||||
nationality: "NLD",
|
||||
performance: 1.020,
|
||||
},
|
||||
vettel: {
|
||||
id: "vettel",
|
||||
@@ -294,6 +325,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "VET",
|
||||
nationality: "DEU",
|
||||
performance: 1.003,
|
||||
},
|
||||
zhou: {
|
||||
id: "zhou",
|
||||
@@ -304,6 +336,7 @@ export const drivers: {[lastName: string]: Driver} = {
|
||||
yellowTCam: true,
|
||||
initials: "ZHO",
|
||||
nationality: "CHN",
|
||||
performance: 1.000,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import {
|
||||
BGChyrons,
|
||||
BGStatusIndicatorModes,
|
||||
BGTimingTowerDisplayModes,
|
||||
BGTimingTowerDisplayMode,
|
||||
BGTimingTowerFocusedCarsMode,
|
||||
BGTimingTowerSplitsMode,
|
||||
OpenState,
|
||||
@@ -16,11 +16,11 @@ const initialState: RootState["broadcastGraphics"] = {
|
||||
relativePos: {},
|
||||
openState: 0,
|
||||
statusIndicator: {
|
||||
mode: BGStatusIndicatorModes.NormalNarrow,
|
||||
mode: BGStatusIndicatorModes.LapNarrow,
|
||||
},
|
||||
timingTower: {
|
||||
open: 1,
|
||||
displayMode: BGTimingTowerDisplayModes.LeftAndRight,
|
||||
displayMode: BGTimingTowerDisplayMode.LeftAndRight,
|
||||
splitsMode: BGTimingTowerSplitsMode.Leader,
|
||||
focusedCars: [],
|
||||
focusedCarsMode: BGTimingTowerFocusedCarsMode.None,
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { random } from "lodash";
|
||||
|
||||
import { CourseFlag, CarStatus, RootState, Tyre, TyreCompound, CarNotice } from "../../types/state";
|
||||
import { cloneDriver } from "../../utils/dataLookup";
|
||||
import {
|
||||
CourseFlag,
|
||||
CarStatus,
|
||||
RootState,
|
||||
Tyre,
|
||||
TyreCompound,
|
||||
CarNotice,
|
||||
EventMode,
|
||||
SectorFlag,
|
||||
SafetyCarStatus,
|
||||
VirtualSafetyCarStatus,
|
||||
Car,
|
||||
} from "../../types/state";
|
||||
import { Meters } from "../../types/util";
|
||||
import { orMatch } from "../../utils/common";
|
||||
import { cloneDriver, getTeam } from "../../utils/dataLookup";
|
||||
import { driverToGridMap } from "../../utils/event";
|
||||
|
||||
const DEFAULT_TYRE: Tyre = {
|
||||
compound: TyreCompound.Medium,
|
||||
@@ -9,16 +25,19 @@ const DEFAULT_TYRE: Tyre = {
|
||||
new: true,
|
||||
};
|
||||
|
||||
const GRID_POSITION_GAP: Meters = 8;
|
||||
const POLE_TO_START: Meters = 10;
|
||||
|
||||
const initialState: RootState["event"] = {
|
||||
trackName: "Circuit de Spa-Franchorchamps",
|
||||
trackLength: 7004,
|
||||
courseStatus: {
|
||||
courseFlag: "green",
|
||||
sectorFlags: ["green", "green", "green"],
|
||||
safetyCar: "clear",
|
||||
virtualSafetyCar: "clear",
|
||||
courseFlag: CourseFlag.Green,
|
||||
sectorFlags: [SectorFlag.Green, SectorFlag.Green, SectorFlag.Green],
|
||||
safetyCar: SafetyCarStatus.Clear,
|
||||
virtualSafetyCar: VirtualSafetyCarStatus.Clear,
|
||||
},
|
||||
mode: "race",
|
||||
mode: EventMode.Race,
|
||||
progress: {
|
||||
startTime: Date.now(),
|
||||
timeLimit: 60 * 60 * 2 * 1000,
|
||||
@@ -32,7 +51,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [CarNotice.FastestLap],
|
||||
distance: 2000 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 0,
|
||||
driver: cloneDriver("verstappen"),
|
||||
},
|
||||
{
|
||||
@@ -40,7 +59,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1900 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 1,
|
||||
driver: cloneDriver("hamilton"),
|
||||
},
|
||||
{
|
||||
@@ -48,7 +67,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1800 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 2,
|
||||
driver: cloneDriver("bottas"),
|
||||
},
|
||||
{
|
||||
@@ -56,7 +75,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Retired,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1700 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 3,
|
||||
driver: cloneDriver("perez"),
|
||||
},
|
||||
{
|
||||
@@ -64,7 +83,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1600 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 4,
|
||||
driver: cloneDriver("sainz"),
|
||||
},
|
||||
{
|
||||
@@ -72,7 +91,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Retired,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1500 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 5,
|
||||
driver: cloneDriver("norris"),
|
||||
},
|
||||
{
|
||||
@@ -80,7 +99,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1400 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 6,
|
||||
driver: cloneDriver("leclerc"),
|
||||
},
|
||||
{
|
||||
@@ -88,15 +107,15 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1300 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 7,
|
||||
driver: cloneDriver("ricciardo"),
|
||||
},
|
||||
{
|
||||
position: 9,
|
||||
status: CarStatus.DidNotStart,
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1200 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 8,
|
||||
driver: cloneDriver("gasly"),
|
||||
},
|
||||
{
|
||||
@@ -104,7 +123,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1100 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 9,
|
||||
driver: cloneDriver("alonso"),
|
||||
},
|
||||
{
|
||||
@@ -112,7 +131,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 1000 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 10,
|
||||
driver: cloneDriver("ocon"),
|
||||
},
|
||||
{
|
||||
@@ -120,7 +139,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 900 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 11,
|
||||
driver: cloneDriver("vettel"),
|
||||
},
|
||||
{
|
||||
@@ -128,7 +147,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 800 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 12,
|
||||
driver: cloneDriver("stroll"),
|
||||
},
|
||||
{
|
||||
@@ -136,7 +155,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 700 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 13,
|
||||
driver: cloneDriver("tsunoda"),
|
||||
},
|
||||
{
|
||||
@@ -144,7 +163,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 600 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 14,
|
||||
driver: cloneDriver("russell"),
|
||||
},
|
||||
{
|
||||
@@ -152,7 +171,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 500 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 15,
|
||||
driver: cloneDriver("raikkonen"),
|
||||
},
|
||||
{
|
||||
@@ -160,7 +179,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 400 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 16,
|
||||
driver: cloneDriver("latifi"),
|
||||
},
|
||||
{
|
||||
@@ -168,7 +187,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 300 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 17,
|
||||
driver: cloneDriver("giovinazzi"),
|
||||
},
|
||||
{
|
||||
@@ -176,7 +195,7 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 200 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 18,
|
||||
driver: cloneDriver("schumacher"),
|
||||
},
|
||||
{
|
||||
@@ -184,13 +203,25 @@ const initialState: RootState["event"] = {
|
||||
status: CarStatus.Normal,
|
||||
tyre: DEFAULT_TYRE,
|
||||
notices: [],
|
||||
distance: 100 * 4,
|
||||
distance: POLE_TO_START - GRID_POSITION_GAP * 19,
|
||||
driver: cloneDriver("mazepin"),
|
||||
},
|
||||
],
|
||||
lastUpdate: Date.now(),
|
||||
};
|
||||
|
||||
interface IncreaseDistanceAction {
|
||||
cars: Car[];
|
||||
distance: Meters;
|
||||
randomness: number;
|
||||
usePerformance: boolean;
|
||||
}
|
||||
|
||||
interface SetCarStatusAction {
|
||||
cars: Car[];
|
||||
status: CarStatus;
|
||||
}
|
||||
|
||||
export const eventSlice = createSlice({
|
||||
name: "event",
|
||||
initialState,
|
||||
@@ -226,11 +257,63 @@ export const eventSlice = createSlice({
|
||||
state.leaderGridSpot = sortingGrid[0].gridSpot;
|
||||
state.lastUpdate = Date.now();
|
||||
},
|
||||
increaseDistance: (state, action: PayloadAction<IncreaseDistanceAction>) => {
|
||||
const gridMap = driverToGridMap(state.grid);
|
||||
|
||||
const { cars, distance, randomness, usePerformance } = action.payload;
|
||||
|
||||
cars.forEach(car => {
|
||||
// Do not update cars that are DNS, retired, or finished.
|
||||
// This does remind me that Finished cars must be treated and reported
|
||||
// differently...
|
||||
if (orMatch(car.status, CarStatus.DidNotStart, CarStatus.Finished, CarStatus.Retired)) {
|
||||
return;
|
||||
}
|
||||
let addedDistance = distance;
|
||||
|
||||
if (randomness !== 0){
|
||||
addedDistance *= random(1 - randomness, 1 + randomness);
|
||||
}
|
||||
if (usePerformance) {
|
||||
addedDistance *=
|
||||
getTeam(car.driver.team.id).performance + car.driver.performance;
|
||||
}
|
||||
state.grid[gridMap[car.driver.id]].distance += addedDistance;
|
||||
});
|
||||
state.lastUpdate = Date.now();
|
||||
},
|
||||
awardFastestLap: (state, action: PayloadAction<Car>) => {
|
||||
// Awards fastest lap to provided car. Removes fastest lap from anyone else.
|
||||
state.grid.forEach((car, index) => {
|
||||
const fastestLapNoticeIndex = car.notices.findIndex(
|
||||
notice => notice === CarNotice.FastestLap,
|
||||
);
|
||||
if (car.driver.id === action.payload.driver.id) {
|
||||
if (fastestLapNoticeIndex === -1) {
|
||||
state.grid[index].notices.push(CarNotice.FastestLap);
|
||||
}
|
||||
} else if (fastestLapNoticeIndex !== -1) {
|
||||
state.grid[index].notices.splice(fastestLapNoticeIndex, 1);
|
||||
}
|
||||
});
|
||||
state.lastUpdate = Date.now();
|
||||
},
|
||||
setCarStatus: (state, action: PayloadAction<SetCarStatusAction>) => {
|
||||
const gridMap = driverToGridMap(state.grid);
|
||||
const { cars, status } = action.payload;
|
||||
cars.forEach(car => {
|
||||
state.grid[gridMap[car.driver.id]].status = status;
|
||||
});
|
||||
state.lastUpdate = Date.now();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {
|
||||
setCourseFlag,
|
||||
refreshRunningOrder,
|
||||
increaseDistance,
|
||||
awardFastestLap,
|
||||
setCarStatus,
|
||||
} = eventSlice.actions;
|
||||
export default eventSlice.reducer;
|
||||
@@ -18,11 +18,14 @@ export const theme = {
|
||||
disabledGreen: "#b1d3b2",
|
||||
activeRed: "#e63746",
|
||||
disabledRed: "#e08a91",
|
||||
posLostRed: "#e40030",
|
||||
posGainedGreen: "#10ff35",
|
||||
grey: "#aaa",
|
||||
lightGrey: "#ddd",
|
||||
faintGrey: "#eee",
|
||||
darkGrey: "#303030",
|
||||
videoFrameBG: "#333",
|
||||
positionFlagBG: "#f4f3ee",
|
||||
teams: { // 2021 Season
|
||||
alfaRomeo: "#900000",
|
||||
alphaTauri: "#2b4562",
|
||||
|
||||
+39
-27
@@ -74,7 +74,7 @@ export interface Event {
|
||||
courseStatus: CourseStatus;
|
||||
mode: EventMode;
|
||||
progress: EventProgress;
|
||||
leaderGridSpot: GridSpot;
|
||||
leaderGridSpot: GridSpot; // Might be removed.
|
||||
grid: Grid;
|
||||
// gridPositions: GridSpot[];
|
||||
lastUpdate: number;
|
||||
@@ -85,39 +85,49 @@ export interface EventProgress {
|
||||
currentLap: number;
|
||||
lapCount: number;
|
||||
}
|
||||
export type EventMode =
|
||||
| "race"
|
||||
| "sprint"
|
||||
| "p1"
|
||||
| "p2"
|
||||
| "p3"
|
||||
| "q1"
|
||||
| "q2"
|
||||
| "q3";
|
||||
export enum EventMode {
|
||||
Race,
|
||||
Sprint,
|
||||
Practice1,
|
||||
Practice2,
|
||||
Practice3,
|
||||
Qualifying1,
|
||||
Qualifying2,
|
||||
Qualifying3,
|
||||
}
|
||||
export interface CourseStatus {
|
||||
courseFlag: CourseFlag;
|
||||
sectorFlags: CourseFlag[];
|
||||
sectorFlags: SectorFlag[];
|
||||
safetyCar: SafetyCarStatus;
|
||||
virtualSafetyCar: VirtualSafetyCarStatus;
|
||||
}
|
||||
export type CourseFlag =
|
||||
| "green"
|
||||
| "yellow"
|
||||
| "doubleYellow"
|
||||
| "chequered"
|
||||
| "red"
|
||||
| "white"
|
||||
| "redYellow";
|
||||
export type SafetyCarStatus = "clear" | "starting" | "out" | "ending";
|
||||
export type VirtualSafetyCarStatus = "clear" | "out" | "ending";
|
||||
|
||||
export enum CourseFlag {
|
||||
Green,
|
||||
Yellow,
|
||||
Chequered,
|
||||
Red,
|
||||
}
|
||||
|
||||
export enum SectorFlag {
|
||||
Green,
|
||||
Yellow,
|
||||
DoubleYellow,
|
||||
White,
|
||||
RedYellow,
|
||||
}
|
||||
|
||||
export enum SafetyCarStatus { Clear, Starting, Out, Ending }
|
||||
export enum VirtualSafetyCarStatus { Clear, Active, Ending }
|
||||
export type Grid = Car[]; // Grid order does not change.
|
||||
export type GridSpot = number;
|
||||
export interface Car {
|
||||
position: number;
|
||||
position: number; // Position is DERIVED from distance and status.
|
||||
driver: Driver;
|
||||
status: CarStatus;
|
||||
tyre: Tyre;
|
||||
// flags: ???, // blue, red, meatball, black/white, black
|
||||
// tyreHistory: Tyre[];
|
||||
// pitsCompleted: number;
|
||||
notices: CarNotice[];
|
||||
distance: Meters;
|
||||
}
|
||||
@@ -130,6 +140,7 @@ export interface Driver {
|
||||
yellowTCam: boolean;
|
||||
initials: string;
|
||||
nationality: string; // ISO 3166-1 alpha-3 codes
|
||||
performance: Fraction; // Versus teammate
|
||||
}
|
||||
export type DriverId =
|
||||
| "albon"
|
||||
@@ -199,6 +210,7 @@ export interface Team {
|
||||
shortName: TeamShortName;
|
||||
fullName: TeamFullName;
|
||||
nationality: string; // ISO 3166-1 alpha-3 codes
|
||||
performance: Fraction;
|
||||
// logo: string;
|
||||
}
|
||||
export type TeamId =
|
||||
@@ -275,19 +287,19 @@ export interface BGStatusIndicator {
|
||||
mode: BGStatusIndicatorModes;
|
||||
}
|
||||
export enum BGStatusIndicatorModes {
|
||||
NormalNarrow, // "LAP" above "##/##" lap count.
|
||||
NormalWide, // "LAP" to the left of "##/##" lap count.
|
||||
LapNarrow, // "LAP" above "##/##" lap count.
|
||||
LapWide, // "LAP" to the left of "##/##" lap count.
|
||||
}
|
||||
|
||||
// Timing Tower
|
||||
export interface BGTimingTower {
|
||||
open: OpenState;
|
||||
displayMode: BGTimingTowerDisplayModes;
|
||||
displayMode: BGTimingTowerDisplayMode;
|
||||
splitsMode: BGTimingTowerSplitsMode,
|
||||
focusedCars: Car[],
|
||||
focusedCarsMode: BGTimingTowerFocusedCarsMode,
|
||||
}
|
||||
export enum BGTimingTowerDisplayModes {
|
||||
export enum BGTimingTowerDisplayMode {
|
||||
Hidden,
|
||||
LeftOnly,
|
||||
LeftAndRight,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cloneDeep } from "lodash";
|
||||
import { drivers, teams, teamNumberStyles, teamFlagStyles, teamGemStyles } from "../domain/data/teams";
|
||||
import { DriverId, Team, TeamId } from "../types/state";
|
||||
import { DriverId, TeamId } from "../types/state";
|
||||
|
||||
/**
|
||||
* Prefer getting data from teams.ts through these simple getter functions.
|
||||
|
||||
+16
-2
@@ -1,4 +1,3 @@
|
||||
import { random } from "lodash";
|
||||
import { Car, Grid } from "../types/state";
|
||||
|
||||
import { Meters } from "../types/util";
|
||||
@@ -13,7 +12,7 @@ export function timeDiff(
|
||||
* 61.015 m/s average. So, let's do that.
|
||||
*/
|
||||
|
||||
return random(0.95, 1.05) * ((front - back) / 61.015);
|
||||
return (front - back) / 61.015;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,3 +26,18 @@ export function getCarAtPos(
|
||||
}
|
||||
return foundCar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function returns a map of driver ids to their index in the Grid. This
|
||||
* removes the need for repeating find functions over and over again when making
|
||||
* bulk changes to a list of cars.
|
||||
* @param grid Master list of cars
|
||||
* @returns
|
||||
*/
|
||||
export function driverToGridMap(grid: Grid) {
|
||||
const gridMap: { [driverId: string]: number } = {};
|
||||
grid.forEach((car, index) => {
|
||||
gridMap[car.driver.id] = index;
|
||||
});
|
||||
return gridMap;
|
||||
}
|
||||
+12
-10
@@ -80,6 +80,7 @@ export function commonTransition(propsArray: TransitionArgs[]) {
|
||||
* @param height element height in pixels
|
||||
* @param progress fraction from 0 to 1
|
||||
* @param outlineThickness the expected max width of the outline
|
||||
* @param interiorThickness the expected max width of the outline internally
|
||||
* @returns
|
||||
*/
|
||||
export function outlineClipPath(
|
||||
@@ -87,6 +88,7 @@ export function outlineClipPath(
|
||||
height: Px,
|
||||
progress: Fraction,
|
||||
outlineThickness: Px,
|
||||
interiorThickness: Px = 0,
|
||||
): [[Px, Px], [Px, Px], [Px, Px], [Px, Px], [Px, Px], [Px, Px]] {
|
||||
const travelDistance = width * 2 + height;
|
||||
const pt1End = width / travelDistance;
|
||||
@@ -96,10 +98,10 @@ export function outlineClipPath(
|
||||
if (progress <= pt1End) {
|
||||
const x = width * progress / pt1End;
|
||||
return [
|
||||
[0, height],
|
||||
[0, height],
|
||||
[0, height],
|
||||
[x, height],
|
||||
[0, height - interiorThickness],
|
||||
[0, height - interiorThickness],
|
||||
[0, height - interiorThickness],
|
||||
[x, height - interiorThickness],
|
||||
[x, height + outlineThickness],
|
||||
[0, height + outlineThickness],
|
||||
];
|
||||
@@ -108,9 +110,9 @@ export function outlineClipPath(
|
||||
} else if (progress > pt1End && progress <= pt2End) {
|
||||
const y = height - (height + outlineThickness) * ((progress - pt1End) / (pt2End - pt1End));
|
||||
return [
|
||||
[0, height],
|
||||
[width - 10, height],
|
||||
[width, y],
|
||||
[0, height - interiorThickness],
|
||||
[width - Math.max(10, interiorThickness), height - interiorThickness],
|
||||
[width - interiorThickness, y],
|
||||
[width + outlineThickness, y],
|
||||
[width + outlineThickness, height + outlineThickness],
|
||||
[0, height + outlineThickness],
|
||||
@@ -120,9 +122,9 @@ export function outlineClipPath(
|
||||
} else {
|
||||
const x = width - width * ((progress - pt2End) / (1 - pt2End));
|
||||
return [
|
||||
[0, height],
|
||||
[x - 10, height],
|
||||
[x, -outlineThickness],
|
||||
[0, height - interiorThickness],
|
||||
[x - Math.max(10, interiorThickness), height - interiorThickness],
|
||||
[x - interiorThickness, -outlineThickness],
|
||||
[width + outlineThickness, -outlineThickness],
|
||||
[width + outlineThickness, height + outlineThickness],
|
||||
[0, height + outlineThickness],
|
||||
|
||||
@@ -1585,6 +1585,11 @@
|
||||
estree-walker "^1.0.1"
|
||||
picomatch "^2.2.2"
|
||||
|
||||
"@rooks/use-timeout-when@^4.11.2":
|
||||
version "4.11.2"
|
||||
resolved "https://registry.yarnpkg.com/@rooks/use-timeout-when/-/use-timeout-when-4.11.2.tgz#12441395abd754ccd4aa93d38598981c26274ef0"
|
||||
integrity sha512-ytSqN4KyDdLtMS69RbiQ/Y4Tc1vyCh508FkLMnEAMF2AQZo/C/7sEL2WnLTz04/fD9AbEgSIpfB28XOourDaNg==
|
||||
|
||||
"@rushstack/eslint-patch@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.1.0.tgz"
|
||||
|
||||
Reference in new issue
Block a user