ISSUE-045 - Chyron Body - Great progress today! It's starting to look legit!
Massive change to the way that Chyrons are built and deployed. Still need to figure out what's wrong with the portrait and the Venetian blinds causing issues. Still need to make the team name flicker.
This commit is contained in:
1 parent
fd18703d1a
commit
b545750f70
6 files changed
+278
-64
No files matched your search
@@ -3,7 +3,7 @@ import { useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { Stack } from "@bedrock-layout/stack";
|
||||
import { Inline } from "@bedrock-layout/inline";
|
||||
import { FaPlay, FaStepForward, FaStop } from "react-icons/fa";
|
||||
import { FaCheck, FaStepForward, FaTimes } from "react-icons/fa";
|
||||
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
import { broadcastDirectorSelector } from "../../../../features/broadcast/director/broadcastDirectorSelector";
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
clearChyrons,
|
||||
incrementChyronsOpenState,
|
||||
setChyrons,
|
||||
setChyronsOpenState,
|
||||
} from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
||||
import { flagModeList, getChyronModesList, getChyronSubModesList } from "../../../../domain/data/broadcastGraphics";
|
||||
import { BGChyronDriver, BGChyronMode, BGChyrons, BGChyronSubMode, Car, FlagMode } from "../../../../types/state";
|
||||
@@ -37,34 +38,29 @@ export function ChyronsDirectorControls() {
|
||||
const { chyrons } = useSelector(broadcastGraphicsSelector);
|
||||
const { selectedCars } = useSelector(broadcastDirectorSelector);
|
||||
|
||||
|
||||
|
||||
// Handle changes to the chyron mode so submodes can be changed accordingly.
|
||||
useEffect(() => {
|
||||
setChyronSubModes(getChyronSubModesList(chyronMode));
|
||||
}, [chyronMode]);
|
||||
|
||||
const onOpen = () => {
|
||||
if (chyronMode === "driver") {
|
||||
if (selectedCars.length === 0) return;
|
||||
let primaryCar = selectedCars[0];
|
||||
let secondaryCar = selectedCars.length > 1 ? selectedCars[1] : null;
|
||||
// Handle changes to selected cars
|
||||
// useEffect(() => {
|
||||
// console.log(selectedCars, chyrons);
|
||||
// // Do not change chyrons while in a non-closed state.
|
||||
// if (chyrons != null && chyrons.openState !== 0) {
|
||||
// return;
|
||||
// }
|
||||
// if (chyronMode === "driver") {
|
||||
// buildDriver();
|
||||
// }
|
||||
// }, [selectedCars]);
|
||||
|
||||
// Auto-sort drivers by position so trailing car always appears second.
|
||||
if (chyronSubMode === "medium" && secondaryCar != null
|
||||
&& secondaryCar.position < primaryCar.position) {
|
||||
secondaryCar = selectedCars[0];
|
||||
primaryCar = selectedCars[1];
|
||||
}
|
||||
const newChyrons: BGChyrons = {
|
||||
openState: 1,
|
||||
relativePos: { top: "0", right: "0", bottom: "0", left: "0" },
|
||||
mode: chyronMode,
|
||||
subMode: chyronSubMode,
|
||||
driver: {
|
||||
primary: buildDriverChyron(primaryCar),
|
||||
secondary: secondaryCar != null ? buildDriverChyron(secondaryCar) : null,
|
||||
},
|
||||
};
|
||||
dispatch(setChyrons(newChyrons));
|
||||
}
|
||||
|
||||
const onOpen = () => {
|
||||
// dispatch(setChyronsOpenState(1));
|
||||
buildDriver();
|
||||
};
|
||||
|
||||
const onNext = () => {
|
||||
@@ -72,7 +68,32 @@ export function ChyronsDirectorControls() {
|
||||
};
|
||||
|
||||
const onClose = () => {
|
||||
dispatch(clearChyrons());
|
||||
dispatch(setChyronsOpenState(-1));
|
||||
};
|
||||
|
||||
const buildDriver = () => {
|
||||
console.log("building driver");
|
||||
if (selectedCars.length === 0) return;
|
||||
let primaryCar = selectedCars[0];
|
||||
let secondaryCar = selectedCars.length > 1 ? selectedCars[1] : null;
|
||||
|
||||
// Auto-sort drivers by position so trailing car always appears second.
|
||||
if (chyronSubMode === "medium" && secondaryCar != null
|
||||
&& secondaryCar.position < primaryCar.position) {
|
||||
secondaryCar = selectedCars[0];
|
||||
primaryCar = selectedCars[1];
|
||||
}
|
||||
const newChyrons: BGChyrons = {
|
||||
openState: 0,
|
||||
relativePos: { top: "0", right: "0", bottom: "0", left: "0" },
|
||||
mode: chyronMode,
|
||||
subMode: chyronSubMode,
|
||||
driver: {
|
||||
primary: buildDriverChyron(primaryCar),
|
||||
secondary: secondaryCar != null ? buildDriverChyron(secondaryCar) : null,
|
||||
},
|
||||
};
|
||||
dispatch(setChyrons(newChyrons));
|
||||
};
|
||||
|
||||
const buildDriverChyron = (car: Car): BGChyronDriver => ({
|
||||
@@ -136,19 +157,19 @@ export function ChyronsDirectorControls() {
|
||||
onClick={onOpen}
|
||||
disabled={chyrons != null}
|
||||
>
|
||||
<FaPlay size="0.8em" />
|
||||
<FaCheck size="0.8em" />
|
||||
</OpenButton>
|
||||
<Button
|
||||
onClick={onNext}
|
||||
disabled={chyrons == null}
|
||||
disabled={chyrons == null || chyrons.openState === -1}
|
||||
>
|
||||
<FaStepForward size="0.8em" />
|
||||
</Button>
|
||||
<CloseButton
|
||||
onClick={onClose}
|
||||
disabled={chyrons == null}
|
||||
disabled={chyrons == null || chyrons.openState <= 0}
|
||||
>
|
||||
<FaStop size="0.8em" />
|
||||
<FaTimes size="0.8em" />
|
||||
</CloseButton>
|
||||
</Inline>
|
||||
</Inline>
|
||||
|
||||
Reference in new issue
Block a user