diff --git a/src/hooks/draggable-window/DraggableWindow.tsx b/src/hooks/draggable-window/DraggableWindow.tsx index 403af1bc..19484805 100644 --- a/src/hooks/draggable-window/DraggableWindow.tsx +++ b/src/hooks/draggable-window/DraggableWindow.tsx @@ -51,6 +51,12 @@ export function DraggableWindow(props: DraggableWindowProps): JSX.Element bringToTop(); + const left = ((document.body.clientWidth - element.clientWidth) / 2); + const top = ((document.body.clientHeight - element.clientHeight) / 2); + + element.style.left = `${ left }px`; + element.style.top = `${ top }px`; + return () => { const index = currentWindows.indexOf(element); @@ -61,7 +67,7 @@ export function DraggableWindow(props: DraggableWindowProps): JSX.Element return ( -
+
{ props.children }