mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Fix recentering bug
This commit is contained in:
parent
a618b049eb
commit
b63cec5cbd
2 changed files with 11 additions and 9 deletions
|
|
@ -12,6 +12,10 @@
|
|||
- Add new config option `enableMediaSession` to allow Webamp to connect to the browser's Media Session API. This enables OS/hardware level media controls like play/pause/next/previous.
|
||||
- Ensure the promise returned from `renderWhenReady` only resolves after the Webamp instance has been fully mounted and inserted into the DOM. Previously it resolved after the DOM node was created but before it was inserted into the DOM.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix bug where resizing the window such that the current layout cannot fit on the page, while also scrolled down the page, would cause the layout to be recentered out of view.
|
||||
|
||||
## 2.1.2 [CURRENT]
|
||||
|
||||
### Bug Fixes
|
||||
|
|
|
|||
|
|
@ -128,25 +128,23 @@ export function centerWindowsInContainer(container: HTMLElement): Thunk {
|
|||
}
|
||||
|
||||
export function centerWindowsInView(): Thunk {
|
||||
return centerWindows({
|
||||
left: window.scrollX,
|
||||
top: window.scrollY,
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
});
|
||||
const height = window.innerHeight;
|
||||
const width = window.innerWidth;
|
||||
return centerWindows({ left: 0, top: 0, width, height });
|
||||
}
|
||||
|
||||
export function centerWindows(box: {
|
||||
type Box = {
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}): Thunk {
|
||||
};
|
||||
|
||||
export function centerWindows({ left, top, width, height }: Box): Thunk {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const windowsInfo = Selectors.getWindowsInfo(state);
|
||||
const getOpen = Selectors.getWindowOpen(state);
|
||||
const { top, left, width, height } = box;
|
||||
|
||||
const offsetLeft = left + window.scrollX;
|
||||
const offsetTop = top + window.scrollY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue