mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 10:15:31 +00:00
Fix initial position when container is not at the top of the page
This commit is contained in:
parent
b92935fa9f
commit
1d31b7fa86
1 changed files with 4 additions and 6 deletions
|
|
@ -37,8 +37,6 @@ 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;
|
||||
|
||||
|
|
@ -53,8 +51,8 @@ class WindowManager extends React.Component {
|
|||
keys.forEach((key, i) => {
|
||||
const offset = WINDOW_HEIGHT * i;
|
||||
windowPositions[key] = {
|
||||
x: Math.ceil(offsetLeft + globalOffsetLeft),
|
||||
y: Math.ceil(offsetTop + (globalOffsetTop + offset))
|
||||
x: Math.ceil(globalOffsetLeft),
|
||||
y: Math.ceil(globalOffsetTop + offset)
|
||||
};
|
||||
});
|
||||
this.props.updateWindowPositions(windowPositions);
|
||||
|
|
@ -69,8 +67,8 @@ class WindowManager extends React.Component {
|
|||
const boxWidth = bounding.right - bounding.left;
|
||||
|
||||
const move = {
|
||||
x: offsetLeft + (width - boxWidth) / 2,
|
||||
y: offsetTop + (height - boxHeight) / 2
|
||||
x: (width - boxWidth) / 2,
|
||||
y: (height - boxHeight) / 2
|
||||
};
|
||||
|
||||
const newPositions = info.reduce(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue