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.
This commit is contained in:
Kyle Geib committed 2022-03-15 13:14:20 -05:00
1 parent d083df7245
commit b48579ac54
8 files changed
+28 -27

No files matched your search

@@ -71,7 +71,7 @@ export function ChyronsDirectorControls() {
} }
const newChyrons: BGChyrons = { const newChyrons: BGChyrons = {
openState: 0, openState: 0,
relativePos: { top: "0", right: "0", bottom: "0", left: "0" }, placement: { top: "0", right: "0", bottom: "0", left: "0" },
mode: chyronMode, mode: chyronMode,
subMode: chyronSubMode, subMode: chyronSubMode,
driver: { driver: {
+2 -3
View File
@@ -1,6 +1,7 @@
import { MockupBlock } from "../../Common/MockupBlock.styled"; import { MockupBlock } from "../../Common/MockupBlock.styled";
import VideoFeed from "../VideoFeed/VideoFeed"; import VideoFeed from "../VideoFeed/VideoFeed";
import { LayoutGrid, LayoutGridItem } from "../../Common/LayoutGrid.styled"; import { LayoutGrid, LayoutGridItem } from "../../Common/LayoutGrid.styled";
import { TimingTowerPrototypeControls } from "../../Workspaces/PrototypingControls/TimingTowerPrototype";
type LayoutProps = { type LayoutProps = {
headerHeight?: number, headerHeight?: number,
@@ -33,9 +34,7 @@ export function Layout({ headerHeight }: LayoutProps) {
</LayoutGridItem> </LayoutGridItem>
<LayoutGridItem column={2} row={7} columnSpan={5} rowSpan={4}> <LayoutGridItem column={2} row={7} columnSpan={5} rowSpan={4}>
<MockupBlock <TimingTowerPrototypeControls />
color="#4d828b"
>Broadcast Director UI</MockupBlock>
</LayoutGridItem> </LayoutGridItem>
</LayoutGrid> </LayoutGrid>
); );
@@ -4,7 +4,7 @@ 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 } from "./styles";
import { MockupBlock } from "../../Common/MockupBlock.styled"; import { TimingBoard } from "../../BroadcastGraphics/TimingBoard";
import bg from "../../../public/images/misc/bg-standin.jpg"; import bg from "../../../public/images/misc/bg-standin.jpg";
@@ -31,11 +31,7 @@ export default function VideoFeed() {
</DimensionsSpan> </DimensionsSpan>
<BackgroundImageDiv src={bg} /> <BackgroundImageDiv src={bg} />
<BroadcastLayout width={broadcastWidth} height={broadcastHeight} scale={layoutScale} > <BroadcastLayout width={broadcastWidth} height={broadcastHeight} scale={layoutScale} >
<MockupBlock <TimingBoard />
width="300px"
height="900px"
color="grey"
/>
</BroadcastLayout> </BroadcastLayout>
</VideoFeedFrame> </VideoFeedFrame>
); );
@@ -5,14 +5,17 @@ import { workspaceSelector } from "../../../features/workspace/workspaceSelector
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,
}; };
export function TimingBoard({ debug = false }: TimingBoardProps) { export function TimingBoard({ debug = false }: TimingBoardProps) {
const { debugDurationMultiplier } = useSelector(workspaceSelector); const { debugDurationMultiplier } = useSelector(workspaceSelector);
const { timingBoard } = useSelector(broadcastGraphicsSelector);
return ( return (
<TimingBoardLayout> <TimingBoardLayout placement={timingBoard.placement}>
<StatusIndicator <StatusIndicator
debugDurationMultiplier={debug ? debugDurationMultiplier : 1} debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
/> />
@@ -1,7 +1,14 @@
import styled from "styled-components/macro"; 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<TimingBoardLayoutProps>`
position: relative; position: relative;
${({ placement }) => placementStyleRules(placement)}
display: flex; display: flex;
flex-direction: column; flex-direction: column;
+7 -5
View File
@@ -1,17 +1,19 @@
import { keys } from "lodash"; 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 // Chyrons Section
const chyronsData: { const chyronsData: {
[mode: BGChyronMode]: { [mode: BGChyronMode]: {
relativePos: BGRelativePos, placement: Placement,
subModes: { subModes: {
[subMode: BGChyronSubMode]: Record<string, unknown>, [subMode: BGChyronSubMode]: Record<string, unknown>,
}, },
}, },
} = { } = {
driver: { driver: {
relativePos: { top: "0", right: "0", bottom: "0", left: "0" }, placement: { top: "0", right: "0", bottom: "0", left: "0" },
subModes: { subModes: {
medium: { width: 582, height: 72 }, medium: { width: 582, height: 72 },
large: { width: 638, height: 98 }, large: { width: 638, height: 98 },
@@ -25,8 +27,8 @@ export function getChyronModesList(): Array<BGChyronMode> {
return keys(chyronsData); return keys(chyronsData);
} }
export function getChyronRelativePos(mode: BGChyronMode): BGRelativePos { export function getChyronRelativePos(mode: BGChyronMode): Placement {
return chyronsData[mode]?.relativePos return chyronsData[mode]?.placement
?? { top: "0", right: "0", bottom: "0", left: "0" }; ?? { top: "0", right: "0", bottom: "0", left: "0" };
} }
@@ -13,8 +13,8 @@ import {
const initialState: RootState["broadcastGraphics"] = { const initialState: RootState["broadcastGraphics"] = {
chyrons: null, chyrons: null,
timingBoard: { timingBoard: {
relativePos: {}, placement: { top: "54px", left: "96px" },
openState: 0, openState: 1,
statusIndicator: { statusIndicator: {
mode: BGStatusIndicatorModes.LapNarrow, mode: BGStatusIndicatorModes.LapNarrow,
}, },
+2 -8
View File
@@ -1,5 +1,5 @@
import { Meters, Milliseconds, Optional } from "./util"; import { Meters, Milliseconds, Optional } from "./util";
import { Corner, Fraction } from "./style"; import { Corner, Fraction, Placement } from "./style";
export interface RootState { export interface RootState {
pageDimensions: PageDimensions; pageDimensions: PageDimensions;
@@ -253,14 +253,8 @@ export interface BroadcastDirector {
} }
// Broadcast Graphics // Broadcast Graphics
export interface BGRelativePos {
top?: string;
right?: string;
bottom?: string;
left?: string;
}
export interface BGBaseState { export interface BGBaseState {
relativePos: BGRelativePos; placement: Placement;
openState: OpenState; openState: OpenState;
} }
/** /**