Move window centering to utils

This commit is contained in:
hensm
2019-02-15 08:21:54 +00:00
parent 005de9cf91
commit 48c5a21e98
3 changed files with 21 additions and 37 deletions

View File

@@ -8,3 +8,14 @@ export function getNextEllipsis (ellipsis) {
else if (ellipsis === "...") "";
};
}
export function getWindowCenteredProps (refWin, width, height) {
const centerX = refWin.left + (refWin.width / 2);
const centerY = refWin.top + (refWin.height / 3);
return {
width, height
, left: Math.floor(centerX - width / 2)
, top: Math.floor(centerY - height / 2)
};
}