ISSUE-053 - Placed Chyrons on video feed.
Adjusted the method that placement is determined. It didn't make much sense to define Placement in state, so I've moved it to the central theme object instead. I also took the time to support +10 laps and minutes with a special xScale setting for the TimingTowerRows.
This commit is contained in:
1 parent
b7d1b23dff
commit
58da0e4895
13 files changed
+74
-23
No files matched your search
@@ -71,7 +71,6 @@ export function ChyronsDirectorControls() {
|
|||||||
}
|
}
|
||||||
const newChyrons: BGChyrons = {
|
const newChyrons: BGChyrons = {
|
||||||
openState: 0,
|
openState: 0,
|
||||||
placement: { top: "0", right: "0", bottom: "0", left: "0" },
|
|
||||||
mode: chyronMode,
|
mode: chyronMode,
|
||||||
subMode: chyronSubMode,
|
subMode: chyronSubMode,
|
||||||
driver: {
|
driver: {
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
|
|
||||||
import VideoFeed from "../VideoFeed/VideoFeed";
|
import VideoFeed from "../VideoFeed/VideoFeed";
|
||||||
|
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
||||||
import { LayoutGrid, LayoutGridItem } from "../../Common/LayoutGrid.styled";
|
import { LayoutGrid, LayoutGridItem } from "../../Common/LayoutGrid.styled";
|
||||||
import { TimingTowerPrototypeControls } from "../../Workspaces/PrototypingControls/TimingTowerPrototype";
|
import { TimingTowerPrototypeControls } from "../../Workspaces/PrototypingControls/TimingTowerPrototype";
|
||||||
|
import { ChyronsDirectorControls } from "../BroadcastDirectorUI/Chyrons";
|
||||||
|
|
||||||
type LayoutProps = {
|
type LayoutProps = {
|
||||||
headerHeight?: number,
|
headerHeight?: number,
|
||||||
@@ -17,7 +20,7 @@ export function Layout({ headerHeight }: LayoutProps) {
|
|||||||
>Timing Board UI</MockupBlock>
|
>Timing Board UI</MockupBlock>
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
|
|
||||||
<LayoutGridItem column={2} row={1} columnSpan={5} rowSpan={7} >
|
<LayoutGridItem column={2} row={1} columnSpan={5} rowSpan={8} >
|
||||||
<VideoFeed />
|
<VideoFeed />
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
|
|
||||||
@@ -33,8 +36,11 @@ export function Layout({ headerHeight }: LayoutProps) {
|
|||||||
>Race Director UI</MockupBlock>
|
>Race Director UI</MockupBlock>
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
|
|
||||||
<LayoutGridItem column={2} row={8} columnSpan={5} rowSpan={3}>
|
<LayoutGridItem column={2} row={9} columnSpan={5} rowSpan={2}>
|
||||||
|
<PadBox padding="lg">
|
||||||
<TimingTowerPrototypeControls />
|
<TimingTowerPrototypeControls />
|
||||||
|
<ChyronsDirectorControls />
|
||||||
|
</PadBox>
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
</LayoutGrid>
|
</LayoutGrid>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ import useMeasure from "react-use-measure";
|
|||||||
import { calculateFitSize, calculateScale } from "../../../utils/styling";
|
import { calculateFitSize, calculateScale } from "../../../utils/styling";
|
||||||
import { theme } from "../../../shared/theme";
|
import { theme } from "../../../shared/theme";
|
||||||
|
|
||||||
import { VideoFeedFrame, BackgroundImageDiv, DimensionsSpan, BroadcastLayout } from "./styles";
|
import { VideoFeedFrame, BackgroundImageDiv, DimensionsSpan, BroadcastLayout, Logo } from "./styles";
|
||||||
import { TimingBoard } from "../../BroadcastGraphics/TimingBoard";
|
import { TimingBoard } from "../../BroadcastGraphics/TimingBoard";
|
||||||
|
import { ChyronContainer } from "../../BroadcastGraphics/Chyrons/Container";
|
||||||
|
|
||||||
import bg from "../../../public/images/misc/bg-standin.jpg";
|
import bg from "../../../public/images/misc/bg-standin.jpg";
|
||||||
|
import f1Logo from "../../../public/images/logos/f1-logo-white.svg";
|
||||||
|
|
||||||
export default function VideoFeed() {
|
export default function VideoFeed() {
|
||||||
const [frameRef, {
|
const [frameRef, {
|
||||||
@@ -17,6 +19,8 @@ export default function VideoFeed() {
|
|||||||
const {
|
const {
|
||||||
dimensionsWidthPx: broadcastWidth,
|
dimensionsWidthPx: broadcastWidth,
|
||||||
dimensionsHeightPx: broadcastHeight,
|
dimensionsHeightPx: broadcastHeight,
|
||||||
|
logoHeightPx,
|
||||||
|
placement,
|
||||||
} = theme.broadcast;
|
} = theme.broadcast;
|
||||||
|
|
||||||
const [layoutWidth, layoutHeight] = calculateFitSize(frameWidth, frameHeight,
|
const [layoutWidth, layoutHeight] = calculateFitSize(frameWidth, frameHeight,
|
||||||
@@ -27,11 +31,15 @@ export default function VideoFeed() {
|
|||||||
return (
|
return (
|
||||||
<VideoFeedFrame centered ref={frameRef}>
|
<VideoFeedFrame centered ref={frameRef}>
|
||||||
<DimensionsSpan>
|
<DimensionsSpan>
|
||||||
{Math.floor(frameWidth)} x {Math.floor(frameHeight)}px
|
Frame: {Math.floor(frameWidth)} x {Math.floor(frameHeight)}px
|
||||||
|
<br />
|
||||||
|
Scaled: {Math.floor(layoutWidth)} x {Math.floor(layoutHeight)}px ({(layoutScale * 100).toFixed(1)}%)
|
||||||
</DimensionsSpan>
|
</DimensionsSpan>
|
||||||
<BackgroundImageDiv src={bg} />
|
<BackgroundImageDiv src={bg} />
|
||||||
<BroadcastLayout width={broadcastWidth} height={broadcastHeight} scale={layoutScale} >
|
<BroadcastLayout width={broadcastWidth} height={broadcastHeight} scale={layoutScale} >
|
||||||
<TimingBoard />
|
<TimingBoard placement={placement.timingBoard} />
|
||||||
|
<ChyronContainer placement={placement.chyrons} />
|
||||||
|
<Logo height={logoHeightPx} placement={placement.logo} src={f1Logo} />
|
||||||
</BroadcastLayout>
|
</BroadcastLayout>
|
||||||
</VideoFeedFrame>
|
</VideoFeedFrame>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import styled, { css } from "styled-components/macro";
|
import styled, { css } from "styled-components/macro";
|
||||||
|
|
||||||
import { Fraction, Px } from "../../../types/style";
|
import { Fraction, Placement, Px } from "../../../types/style";
|
||||||
|
import { placementStyleRules } from "../../../utils/styling";
|
||||||
|
|
||||||
type VideoFeedFrameProps = {
|
type VideoFeedFrameProps = {
|
||||||
centered?: boolean,
|
centered?: boolean,
|
||||||
@@ -61,3 +62,13 @@ export const DimensionsSpan = styled.span`
|
|||||||
color: ${p => p.theme.colors.textWhite};
|
color: ${p => p.theme.colors.textWhite};
|
||||||
font-family: ${p => p.theme.fonts.f1Regular};
|
font-family: ${p => p.theme.fonts.f1Regular};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
type LogoProps = {
|
||||||
|
placement: Placement,
|
||||||
|
height: Px,
|
||||||
|
};
|
||||||
|
export const Logo = styled.img<LogoProps>`
|
||||||
|
position: absolute;
|
||||||
|
${({ placement }) => placementStyleRules(placement)}
|
||||||
|
height: ${({ height }) => height}px;
|
||||||
|
`;
|
||||||
@@ -2,14 +2,16 @@ import { useSelector } from "react-redux";
|
|||||||
|
|
||||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||||
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
||||||
|
import { Placement } from "../../../../types/style";
|
||||||
|
|
||||||
import { ChyronDriver } from "../Driver";
|
import { ChyronDriver } from "../Driver";
|
||||||
import { DoubleChyronContainer } from "./styles";
|
import { ChyronPlacement, DoubleChyronContainer } from "./styles";
|
||||||
|
|
||||||
type ChyronContainerProps = {
|
type ChyronContainerProps = {
|
||||||
debug?: boolean,
|
debug?: boolean,
|
||||||
|
placement?: Placement,
|
||||||
};
|
};
|
||||||
export function ChyronContainer({ debug = false }: ChyronContainerProps) {
|
export function ChyronContainer({ debug = false, placement = {} }: ChyronContainerProps) {
|
||||||
const { chyrons } = useSelector(broadcastGraphicsSelector);
|
const { chyrons } = useSelector(broadcastGraphicsSelector);
|
||||||
const { debugDurationMultiplier } = useSelector(workspaceSelector);
|
const { debugDurationMultiplier } = useSelector(workspaceSelector);
|
||||||
|
|
||||||
@@ -23,8 +25,10 @@ export function ChyronContainer({ debug = false }: ChyronContainerProps) {
|
|||||||
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
if (chyrons.subMode === "medium" && chyrons.driver.secondary) {
|
|
||||||
return (
|
return (
|
||||||
|
<ChyronPlacement placement={placement}>
|
||||||
|
{chyrons.subMode === "medium" && chyrons.driver.secondary ? (
|
||||||
<DoubleChyronContainer>
|
<DoubleChyronContainer>
|
||||||
{primary}
|
{primary}
|
||||||
<ChyronDriver
|
<ChyronDriver
|
||||||
@@ -34,8 +38,7 @@ export function ChyronContainer({ debug = false }: ChyronContainerProps) {
|
|||||||
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||||
/>
|
/>
|
||||||
</DoubleChyronContainer>
|
</DoubleChyronContainer>
|
||||||
|
) : primary}
|
||||||
|
</ChyronPlacement>
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
return primary;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,19 @@
|
|||||||
import styled from "styled-components/macro";
|
import styled from "styled-components/macro";
|
||||||
|
|
||||||
|
import { Placement } from "../../../../types/style";
|
||||||
|
import { placementStyleRules } from "../../../../utils/styling";
|
||||||
|
|
||||||
export const DoubleChyronContainer = styled.div`
|
export const DoubleChyronContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 1196px;
|
width: 1196px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
type ChyronPlacementProps = {
|
||||||
|
placement: Placement,
|
||||||
|
};
|
||||||
|
export const ChyronPlacement = styled.div<ChyronPlacementProps>`
|
||||||
|
position: absolute;
|
||||||
|
${({ placement }) => placementStyleRules(placement)}
|
||||||
|
`;
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
||||||
|
import { Placement } from "../../../types/style";
|
||||||
|
|
||||||
import { TimingBoardLayout } from "./styles";
|
import { TimingBoardLayout } from "./styles";
|
||||||
import { TimingTower } from "./TimingTower";
|
import { TimingTower } from "./TimingTower";
|
||||||
import { StatusIndicator } from "./StatusIndicator";
|
import { StatusIndicator } from "./StatusIndicator";
|
||||||
import { broadcastGraphicsSelector } from "../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
|
||||||
|
|
||||||
type TimingBoardProps = {
|
type TimingBoardProps = {
|
||||||
debug?: boolean,
|
debug?: boolean,
|
||||||
|
placement?: Placement,
|
||||||
};
|
};
|
||||||
export function TimingBoard({ debug = false }: TimingBoardProps) {
|
export function TimingBoard({ debug = false, placement = {} }: TimingBoardProps) {
|
||||||
const { debugDurationMultiplier } = useSelector(workspaceSelector);
|
const { debugDurationMultiplier } = useSelector(workspaceSelector);
|
||||||
const { timingBoard } = useSelector(broadcastGraphicsSelector);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TimingBoardLayout placement={timingBoard.placement}>
|
<TimingBoardLayout placement={placement}>
|
||||||
<StatusIndicator
|
<StatusIndicator
|
||||||
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -153,6 +153,13 @@ export function TimingTowerRow({
|
|||||||
|
|
||||||
xScale = rightHalfContent.includes(":") ? 0.75 : 0.9;
|
xScale = rightHalfContent.includes(":") ? 0.75 : 0.9;
|
||||||
yScale = rightHalfContent.includes("+") ? 1.1 : 1.0;
|
yScale = rightHalfContent.includes("+") ? 1.1 : 1.0;
|
||||||
|
|
||||||
|
if (rightHalfContent.includes("LAPS") && rightHalfContent.length > 7) {
|
||||||
|
xScale = 0.85; // Extreme edge case where +10 laps or more behind.
|
||||||
|
}
|
||||||
|
if (rightHalfContent.length > 9) {
|
||||||
|
xScale = 0.7; // Extreme edge case where +10 minutes or more behind.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ export const TimeDiff = styled.span<TimeDiffProps>`
|
|||||||
color: ${p => p.theme.colors.textWhite};
|
color: ${p => p.theme.colors.textWhite};
|
||||||
font-family: ${p => p.theme.fonts.f1Regular};
|
font-family: ${p => p.theme.fonts.f1Regular};
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
text-align: end;
|
text-align: end;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ type TimingBoardLayoutProps = {
|
|||||||
placement: Placement,
|
placement: Placement,
|
||||||
};
|
};
|
||||||
export const TimingBoardLayout = styled.div<TimingBoardLayoutProps>`
|
export const TimingBoardLayout = styled.div<TimingBoardLayoutProps>`
|
||||||
position: relative;
|
position: absolute;
|
||||||
${({ placement }) => placementStyleRules(placement)}
|
${({ placement }) => placementStyleRules(placement)}
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -13,13 +13,12 @@ import {
|
|||||||
const initialState: RootState["broadcastGraphics"] = {
|
const initialState: RootState["broadcastGraphics"] = {
|
||||||
chyrons: null,
|
chyrons: null,
|
||||||
timingBoard: {
|
timingBoard: {
|
||||||
placement: { top: "54px", left: "96px" },
|
|
||||||
openState: 1,
|
openState: 1,
|
||||||
statusIndicator: {
|
statusIndicator: {
|
||||||
mode: BGStatusIndicatorModes.LapNarrow,
|
mode: BGStatusIndicatorModes.LapNarrow,
|
||||||
},
|
},
|
||||||
timingTower: {
|
timingTower: {
|
||||||
open: 1,
|
openState: 1,
|
||||||
displayMode: BGTimingTowerDisplayMode.LeftAndRight,
|
displayMode: BGTimingTowerDisplayMode.LeftAndRight,
|
||||||
splitsMode: BGTimingTowerSplitsMode.Leader,
|
splitsMode: BGTimingTowerSplitsMode.Leader,
|
||||||
focusedCars: [],
|
focusedCars: [],
|
||||||
|
|||||||
@@ -105,6 +105,12 @@ export const theme = {
|
|||||||
broadcast: {
|
broadcast: {
|
||||||
dimensionsWidthPx: 1920,
|
dimensionsWidthPx: 1920,
|
||||||
dimensionsHeightPx: 1080,
|
dimensionsHeightPx: 1080,
|
||||||
|
logoHeightPx: 40,
|
||||||
|
placement: {
|
||||||
|
chyrons: { bottom: "52px", left: "378px" },
|
||||||
|
timingBoard: { top: "54px", left: "96px" },
|
||||||
|
logo: { left: "86px", bottom: "52px" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -254,7 +254,6 @@ export interface BroadcastDirector {
|
|||||||
|
|
||||||
// Broadcast Graphics
|
// Broadcast Graphics
|
||||||
export interface BGBaseState {
|
export interface BGBaseState {
|
||||||
placement: Placement;
|
|
||||||
openState: OpenState;
|
openState: OpenState;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -287,7 +286,7 @@ export enum BGStatusIndicatorModes {
|
|||||||
|
|
||||||
// Timing Tower
|
// Timing Tower
|
||||||
export interface BGTimingTower {
|
export interface BGTimingTower {
|
||||||
open: OpenState;
|
openState: OpenState;
|
||||||
displayMode: BGTimingTowerDisplayMode;
|
displayMode: BGTimingTowerDisplayMode;
|
||||||
splitsMode: BGTimingTowerSplitsMode,
|
splitsMode: BGTimingTowerSplitsMode,
|
||||||
focusedCars: Car[],
|
focusedCars: Car[],
|
||||||
|
|||||||
Reference in new issue
Block a user