From b48579ac54956ee8f8f09cd5d1080f3921743c57 Mon Sep 17 00:00:00 2001 From: Kyle Geib Date: Tue, 15 Mar 2022 13:14:20 -0500 Subject: [PATCH] ISSUE-053 - Placed TimingBoard into the video feed element. But the scaling is messing with the clip path because the clip path values do not follow the scale correctly. The issue is, say our scale is 50%. A PositionFlag on the TimingBoard is normally 32x32px in size. That means that the size of the actual PositionFlag while scaled is 16x16. The WipeTransition component takes the effective size of its child element using the useMeasure() hook. So it sees the size is 16x16, thus, when the wipe is set to visible its clip dimensions on the opposite and adjacent points of the triangle are 16px away from origin. But because we're scaled at 50% that clip path effectively becomes 8px. The clip path is doubly scaled. As a result I'm seeing white squares in the corner of the PositionFlag component. I think I might be able to solve this by using simple division to express the values of the clip path in percentages. Or I'll find a way to avoid the double scaling issue. --- .../Chyrons/ChyronsDirectorControls.tsx | 2 +- src/components/Broadcast/Layout/Layout.tsx | 5 ++--- src/components/Broadcast/VideoFeed/VideoFeed.tsx | 8 ++------ .../BroadcastGraphics/TimingBoard/TimingBoard.tsx | 5 ++++- .../BroadcastGraphics/TimingBoard/styles.ts | 9 ++++++++- src/domain/data/broadcastGraphics.ts | 12 +++++++----- .../broadcast/graphics/broadcastGraphicsSlice.ts | 4 ++-- src/types/state.ts | 10 ++-------- 8 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/components/Broadcast/BroadcastDirectorUI/Chyrons/ChyronsDirectorControls.tsx b/src/components/Broadcast/BroadcastDirectorUI/Chyrons/ChyronsDirectorControls.tsx index 5c5235e..2bb577b 100644 --- a/src/components/Broadcast/BroadcastDirectorUI/Chyrons/ChyronsDirectorControls.tsx +++ b/src/components/Broadcast/BroadcastDirectorUI/Chyrons/ChyronsDirectorControls.tsx @@ -71,7 +71,7 @@ export function ChyronsDirectorControls() { } const newChyrons: BGChyrons = { openState: 0, - relativePos: { top: "0", right: "0", bottom: "0", left: "0" }, + placement: { top: "0", right: "0", bottom: "0", left: "0" }, mode: chyronMode, subMode: chyronSubMode, driver: { diff --git a/src/components/Broadcast/Layout/Layout.tsx b/src/components/Broadcast/Layout/Layout.tsx index 1e1f818..13c0a07 100644 --- a/src/components/Broadcast/Layout/Layout.tsx +++ b/src/components/Broadcast/Layout/Layout.tsx @@ -1,6 +1,7 @@ import { MockupBlock } from "../../Common/MockupBlock.styled"; import VideoFeed from "../VideoFeed/VideoFeed"; import { LayoutGrid, LayoutGridItem } from "../../Common/LayoutGrid.styled"; +import { TimingTowerPrototypeControls } from "../../Workspaces/PrototypingControls/TimingTowerPrototype"; type LayoutProps = { headerHeight?: number, @@ -33,9 +34,7 @@ export function Layout({ headerHeight }: LayoutProps) { - Broadcast Director UI + ); diff --git a/src/components/Broadcast/VideoFeed/VideoFeed.tsx b/src/components/Broadcast/VideoFeed/VideoFeed.tsx index e9d5908..ee79789 100644 --- a/src/components/Broadcast/VideoFeed/VideoFeed.tsx +++ b/src/components/Broadcast/VideoFeed/VideoFeed.tsx @@ -4,7 +4,7 @@ import { calculateFitSize, calculateScale } from "../../../utils/styling"; import { theme } from "../../../shared/theme"; import { VideoFeedFrame, BackgroundImageDiv, DimensionsSpan, BroadcastLayout } from "./styles"; -import { MockupBlock } from "../../Common/MockupBlock.styled"; +import { TimingBoard } from "../../BroadcastGraphics/TimingBoard"; import bg from "../../../public/images/misc/bg-standin.jpg"; @@ -31,11 +31,7 @@ export default function VideoFeed() { - + ); diff --git a/src/components/BroadcastGraphics/TimingBoard/TimingBoard.tsx b/src/components/BroadcastGraphics/TimingBoard/TimingBoard.tsx index 0164ed7..1cd86ac 100644 --- a/src/components/BroadcastGraphics/TimingBoard/TimingBoard.tsx +++ b/src/components/BroadcastGraphics/TimingBoard/TimingBoard.tsx @@ -5,14 +5,17 @@ import { workspaceSelector } from "../../../features/workspace/workspaceSelector import { TimingBoardLayout } from "./styles"; import { TimingTower } from "./TimingTower"; import { StatusIndicator } from "./StatusIndicator"; +import { broadcastGraphicsSelector } from "../../../features/broadcast/graphics/broadcastGraphicsSelector"; type TimingBoardProps = { debug?: boolean, }; export function TimingBoard({ debug = false }: TimingBoardProps) { const { debugDurationMultiplier } = useSelector(workspaceSelector); + const { timingBoard } = useSelector(broadcastGraphicsSelector); + return ( - + diff --git a/src/components/BroadcastGraphics/TimingBoard/styles.ts b/src/components/BroadcastGraphics/TimingBoard/styles.ts index 347222d..a5802ed 100644 --- a/src/components/BroadcastGraphics/TimingBoard/styles.ts +++ b/src/components/BroadcastGraphics/TimingBoard/styles.ts @@ -1,7 +1,14 @@ import styled from "styled-components/macro"; -export const TimingBoardLayout = styled.div` +import { Placement } from "../../../types/style"; +import { placementStyleRules } from "../../../utils/styling"; + +type TimingBoardLayoutProps = { + placement: Placement, +}; +export const TimingBoardLayout = styled.div` position: relative; + ${({ placement }) => placementStyleRules(placement)} display: flex; flex-direction: column; diff --git a/src/domain/data/broadcastGraphics.ts b/src/domain/data/broadcastGraphics.ts index 05940ce..ed56aa0 100644 --- a/src/domain/data/broadcastGraphics.ts +++ b/src/domain/data/broadcastGraphics.ts @@ -1,17 +1,19 @@ import { keys } from "lodash"; -import { BGChyronSubMode, BGChyronMode, BGRelativePos, FlagMode } from "../../types/state"; + +import { BGChyronSubMode, BGChyronMode, FlagMode } from "../../types/state"; +import { Placement } from "../../types/style"; // Chyrons Section const chyronsData: { [mode: BGChyronMode]: { - relativePos: BGRelativePos, + placement: Placement, subModes: { [subMode: BGChyronSubMode]: Record, }, }, } = { driver: { - relativePos: { top: "0", right: "0", bottom: "0", left: "0" }, + placement: { top: "0", right: "0", bottom: "0", left: "0" }, subModes: { medium: { width: 582, height: 72 }, large: { width: 638, height: 98 }, @@ -25,8 +27,8 @@ export function getChyronModesList(): Array { return keys(chyronsData); } -export function getChyronRelativePos(mode: BGChyronMode): BGRelativePos { - return chyronsData[mode]?.relativePos +export function getChyronRelativePos(mode: BGChyronMode): Placement { + return chyronsData[mode]?.placement ?? { top: "0", right: "0", bottom: "0", left: "0" }; } diff --git a/src/features/broadcast/graphics/broadcastGraphicsSlice.ts b/src/features/broadcast/graphics/broadcastGraphicsSlice.ts index ffcbc5f..5e41089 100644 --- a/src/features/broadcast/graphics/broadcastGraphicsSlice.ts +++ b/src/features/broadcast/graphics/broadcastGraphicsSlice.ts @@ -13,8 +13,8 @@ import { const initialState: RootState["broadcastGraphics"] = { chyrons: null, timingBoard: { - relativePos: {}, - openState: 0, + placement: { top: "54px", left: "96px" }, + openState: 1, statusIndicator: { mode: BGStatusIndicatorModes.LapNarrow, }, diff --git a/src/types/state.ts b/src/types/state.ts index ad83a28..a91b509 100644 --- a/src/types/state.ts +++ b/src/types/state.ts @@ -1,5 +1,5 @@ import { Meters, Milliseconds, Optional } from "./util"; -import { Corner, Fraction } from "./style"; +import { Corner, Fraction, Placement } from "./style"; export interface RootState { pageDimensions: PageDimensions; @@ -253,14 +253,8 @@ export interface BroadcastDirector { } // Broadcast Graphics -export interface BGRelativePos { - top?: string; - right?: string; - bottom?: string; - left?: string; -} export interface BGBaseState { - relativePos: BGRelativePos; + placement: Placement; openState: OpenState; } /**