ISSUE-017 - Implemented drag bounds that consider the dimensions of dragged element.

This is bugged as the resize observer I'm using doesn't update itself when I reveal the OverlayItem from hiding.
This commit is contained in:
Kyle Geib committed 2022-01-13 15:00:21 -05:00
1 parent 861d702a27
commit aba5cc20be
5 files changed
+51 -25

No files matched your search

@@ -16,11 +16,14 @@ 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();
const { animatedBG } = useSelector(workspaceSelector);
const { currentWorkspaceId: overlayWorkspaceId } = useSelector(overlayToolSelector);
const dispatch = useDispatch();
useEffect(() => {
if (workspaceId == null) return;
@@ -45,13 +48,23 @@ export const Workspace = () => {
centerChildren
>
<H2>{workspaceId ? workspaceObject[workspaceId].name : "Unknown"}</H2>
<PreviewWindow height={600} width={800} animatedBG={animatedBG}>
<PreviewWindow
height={PREVIEW_WINDOW_HEIGHT}
width={PREVIEW_WINDOW_WIDTH}
animatedBG={animatedBG}
>
<MockupBlock
color="#415bad"
height="300px"
width="400px"
>Preview Item</MockupBlock>
<OverlayDisplay />
<OverlayDisplay
containerDimensions={{
height: PREVIEW_WINDOW_HEIGHT,
width: PREVIEW_WINDOW_WIDTH,
}}
bleedover={50}
/>
</PreviewWindow>
<ControlsContainer>
<WorkspaceControls />
@@ -15,7 +15,7 @@ export const WorkspaceList = ({ headerOffset }: WorkspaceListProps) => {
return (
<WorkspaceListBox headerOffset={headerOffset}>
<Stack as="ul" gutter="md">
{workspaceList.map((id, i) => (
{workspaceList.map((id) => (
<WorkspaceListNavLink
key={id}
to={id}