From 0fd5eedf9d4df621b9285e7b4e9b7e60bbaaf0a6 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 24 Jun 2018 09:23:30 -0700 Subject: [PATCH] Revert "Fix initial position when container is not at the top of the page" This reverts commit 1d31b7fa8668fd3340cf16bc4ce8bbcdc247ebb3. --- js/components/WindowManager.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/components/WindowManager.js b/js/components/WindowManager.js index aa9c6702..9a7bcae8 100644 --- a/js/components/WindowManager.js +++ b/js/components/WindowManager.js @@ -37,6 +37,8 @@ class WindowManager extends React.Component { centerWindows() { const { container } = this.props; + const offsetLeft = container.offsetLeft; + const offsetTop = container.offsetTop; const width = container.scrollWidth; const height = container.scrollHeight; @@ -51,8 +53,8 @@ class WindowManager extends React.Component { keys.forEach((key, i) => { const offset = WINDOW_HEIGHT * i; windowPositions[key] = { - x: Math.ceil(globalOffsetLeft), - y: Math.ceil(globalOffsetTop + offset) + x: Math.ceil(offsetLeft + globalOffsetLeft), + y: Math.ceil(offsetTop + (globalOffsetTop + offset)) }; }); this.props.updateWindowPositions(windowPositions); @@ -67,8 +69,8 @@ class WindowManager extends React.Component { const boxWidth = bounding.right - bounding.left; const move = { - x: (width - boxWidth) / 2, - y: (height - boxHeight) / 2 + x: offsetLeft + (width - boxWidth) / 2, + y: offsetTop + (height - boxHeight) / 2 }; const newPositions = info.reduce(