ISSUE-017 - Implemented image overlay solution that I'm happy with.
Shout-out to Blair Wadman for revealing a method to display an image at 1:1 pixel scale and having the div that houses it automatically match that size without any fuss. (Here: https://befused.com/css/flexbox-prevent-image-shrinking/).
This commit is contained in:
1 parent
8780d2a9db
commit
f51df58d17
12 files changed
+70
-94
No files matched your search
@@ -16,9 +16,6 @@ import { OverlayDisplay } from "../../OverlayTool";
|
||||
|
||||
import { workspaceObject } from "../workspaces";
|
||||
|
||||
const PREVIEW_WINDOW_HEIGHT = 600;
|
||||
const PREVIEW_WINDOW_WIDTH = 800;
|
||||
|
||||
export const Workspace = () => {
|
||||
const dispatch = useDispatch();
|
||||
const { workspaceId } = useParams();
|
||||
@@ -40,6 +37,9 @@ export const Workspace = () => {
|
||||
}
|
||||
}, [workspaceId]);
|
||||
|
||||
if (workspaceId == null) return null;
|
||||
const workspace = workspaceObject[workspaceId];
|
||||
|
||||
return (
|
||||
<Stack
|
||||
gutter="lg"
|
||||
@@ -47,23 +47,18 @@ export const Workspace = () => {
|
||||
maxWidth="80%"
|
||||
centerChildren
|
||||
>
|
||||
<H2>{workspaceId ? workspaceObject[workspaceId].name : "Unknown"}</H2>
|
||||
<H2>{workspaceId ? workspace.name : "Unknown"}</H2>
|
||||
<PreviewWindow
|
||||
height={PREVIEW_WINDOW_HEIGHT}
|
||||
width={PREVIEW_WINDOW_WIDTH}
|
||||
dimensions={workspace.previewWindowDimensions}
|
||||
animatedBG={animatedBG}
|
||||
>
|
||||
<MockupBlock
|
||||
color="#415bad"
|
||||
height="300px"
|
||||
width="400px"
|
||||
height="100px"
|
||||
width="100px"
|
||||
>Preview Item</MockupBlock>
|
||||
<OverlayDisplay
|
||||
containerDimensions={{
|
||||
height: PREVIEW_WINDOW_HEIGHT,
|
||||
width: PREVIEW_WINDOW_WIDTH,
|
||||
}}
|
||||
bleedover={50}
|
||||
containerDimensions={workspace.previewWindowDimensions}
|
||||
/>
|
||||
</PreviewWindow>
|
||||
<ControlsContainer>
|
||||
|
||||
@@ -2,6 +2,7 @@ import styled, { css, keyframes } from "styled-components";
|
||||
import { PadBox } from "@bedrock-layout/padbox";
|
||||
|
||||
import bg from "../../../public/images/misc/checker-40x40.png";
|
||||
import { Dimensions } from "../../../types/state";
|
||||
|
||||
const scrollAnimation = keyframes`
|
||||
from { background-position: 0 0; }
|
||||
@@ -9,8 +10,7 @@ const scrollAnimation = keyframes`
|
||||
`;
|
||||
|
||||
export type PreviewWindowProps = {
|
||||
height: number,
|
||||
width: number,
|
||||
dimensions: Dimensions,
|
||||
animatedBG?: boolean,
|
||||
};
|
||||
export const PreviewWindow = styled(PadBox).attrs(() => ({
|
||||
@@ -21,8 +21,8 @@ export const PreviewWindow = styled(PadBox).attrs(() => ({
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
height: ${({ height }) => height}px;
|
||||
width: ${({ width }) => width}px;
|
||||
height: ${({ dimensions }) => dimensions.height}px;
|
||||
width: ${({ dimensions }) => dimensions.width}px;
|
||||
|
||||
border-radius: 1em;
|
||||
|
||||
|
||||
@@ -1,57 +1,24 @@
|
||||
import { OverlayIds } from "../../types/state";
|
||||
import { Dimensions, OverlayIds } from "../../types/state";
|
||||
|
||||
export type WorkspaceObject = {
|
||||
[id: string]: {
|
||||
name: string,
|
||||
overlayIds: OverlayIds,
|
||||
previewWindowDimensions: Dimensions,
|
||||
},
|
||||
};
|
||||
export const workspaceObject: WorkspaceObject = {
|
||||
workspace1: {
|
||||
name: "Workspace 1",
|
||||
overlayIds: ["red", "blue", "white"],
|
||||
chyronSimple: {
|
||||
name: "Chyron Simple",
|
||||
overlayIds: [
|
||||
"chyron-simple-full.png",
|
||||
"chyron-simple-opening-1.png",
|
||||
"chyron-simple-opening-2.png",
|
||||
],
|
||||
previewWindowDimensions: {
|
||||
width: 650,
|
||||
height: 200,
|
||||
},
|
||||
},
|
||||
workspace2: {
|
||||
name: "Workspace 2",
|
||||
overlayIds: ["green"],
|
||||
},
|
||||
workspace3: {
|
||||
name: "Workspace 3",
|
||||
overlayIds: ["green"],
|
||||
},
|
||||
workspace4: {
|
||||
name: "Workspace 4 has a longer name than the rest",
|
||||
overlayIds: ["green"],
|
||||
},
|
||||
blah0: { name: "blah", overlayIds: ["green"] },
|
||||
blah1: { name: "blah", overlayIds: ["green"] },
|
||||
blah2: { name: "blah", overlayIds: ["green"] },
|
||||
blah3: { name: "blah", overlayIds: ["green"] },
|
||||
blah4: { name: "blah", overlayIds: ["green"] },
|
||||
blah5: { name: "blah", overlayIds: ["green"] },
|
||||
blah6: { name: "blah", overlayIds: ["green"] },
|
||||
blah7: { name: "blah", overlayIds: ["green"] },
|
||||
blah8: { name: "blah", overlayIds: ["green"] },
|
||||
blah9: { name: "blah", overlayIds: ["green"] },
|
||||
blah10: { name: "blah", overlayIds: ["green"] },
|
||||
blah11: { name: "blah", overlayIds: ["green"] },
|
||||
blah12: { name: "blah", overlayIds: ["green"] },
|
||||
blah13: { name: "blah", overlayIds: ["green"] },
|
||||
blah14: { name: "blah", overlayIds: ["green"] },
|
||||
blah15: { name: "blah", overlayIds: ["green"] },
|
||||
blah16: { name: "blah", overlayIds: ["green"] },
|
||||
blah17: { name: "blah", overlayIds: ["green"] },
|
||||
blah18: { name: "blah", overlayIds: ["green"] },
|
||||
blah19: { name: "blah", overlayIds: ["green"] },
|
||||
blah20: { name: "blah", overlayIds: ["green"] },
|
||||
blah21: { name: "blah", overlayIds: ["green"] },
|
||||
blah22: { name: "blah", overlayIds: ["green"] },
|
||||
blah23: { name: "blah", overlayIds: ["green"] },
|
||||
blah24: { name: "blah", overlayIds: ["green"] },
|
||||
blah25: { name: "blah", overlayIds: ["green"] },
|
||||
blah26: { name: "blah", overlayIds: ["green"] },
|
||||
blah27: { name: "blah", overlayIds: ["green"] },
|
||||
blah28: { name: "blah", overlayIds: ["green"] },
|
||||
blah29: { name: "blah", overlayIds: ["green"] },
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user