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