diff --git a/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx b/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx index aa0c38a..cf1ccfb 100644 --- a/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx +++ b/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx @@ -5,7 +5,7 @@ import { useDrag } from "@use-gesture/react"; import { overlayToolSelector } from "../../../features/overlayTool/overlayToolSelector"; import { setPosition } from "../../../features/overlayTool/overlayToolSlice"; -import { OverlayItemContainer } from "./styles"; +import { AnimatedOverlayItemContainer } from "./styles"; export function OverlayDisplay() { const { currentOverlayItem, visible } = useSelector(overlayToolSelector); @@ -37,21 +37,20 @@ export function OverlayDisplay() { return ( transition((style, visible) => visible ? ( - - + + {id}
(x:{position.x}px, y:{position.y}px) -
+
) : null, ) diff --git a/src/components/OverlayTool/OverlayDisplay/styles.ts b/src/components/OverlayTool/OverlayDisplay/styles.ts index de78e35..50e9c68 100644 --- a/src/components/OverlayTool/OverlayDisplay/styles.ts +++ b/src/components/OverlayTool/OverlayDisplay/styles.ts @@ -1,3 +1,4 @@ +import { animated } from "@react-spring/web"; import styled from "styled-components"; import { OverlayPosition } from "../../../types/state"; @@ -11,8 +12,8 @@ export const OverlayItemContainer = styled.div.attrs( visible, }) => ({ style: { - // top: y, - // left: x, + top: y, + left: x, display: visible ? undefined : "none", }, }))` @@ -24,3 +25,23 @@ export const OverlayItemContainer = styled.div.attrs( `; OverlayItemContainer.displayName = "OverlayItemContainer"; +type AnimatedOverlayItemContainerProps = { + visible: boolean, +} +export const AnimatedOverlayItemContainer = styled(animated.div).attrs(({ + visible, +}) => ({ + style: { + display: visible ? undefined : "none", + }, +}))` + position: absolute; + z-index: 1; + + /* Temporary. Overlay will be transparent and based on an image. */ + width: 150px; + height: 150px; + background-color: white; + box-shadow: 0px 7px 11px 1px black; +`; +