fix: Context menus can extend outside of window bounds

closes #2492
This commit is contained in:
Tom Moor
2021-09-26 17:07:44 -07:00
parent 9545113d9e
commit 6f136e342f
2 changed files with 30 additions and 4 deletions

View File

@@ -4,8 +4,8 @@ import * as React from "react";
export default function useWindowSize() {
const [windowSize, setWindowSize] = React.useState({
width: undefined,
height: undefined,
width: parseInt(window.innerWidth),
height: parseInt(window.innerHeight),
});
React.useEffect(() => {
@@ -13,8 +13,8 @@ export default function useWindowSize() {
const handleResize = debounce(() => {
// Set window width/height to state
setWindowSize({
width: window.innerWidth,
height: window.innerHeight,
width: parseInt(window.innerWidth),
height: parseInt(window.innerHeight),
});
}, 100);