fixed layer til the end of time

This commit is contained in:
Olivier Gagnon 2021-10-15 14:16:30 -04:00
parent 5e9143371a
commit 515f9e5d4b

@ -11,7 +11,8 @@ import { ResizableBox } from "react-resizable";
import makeStyles from "@mui/styles/makeStyles";
import createStyles from "@mui/styles/createStyles";
import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
import _ from "lodash";
let layerCounter = 0;
export const LogBoxEvents = new EventEmitter<[RunningScript]>();
@ -92,13 +93,8 @@ function LogWindow(props: IProps): React.ReactElement {
function updateLayer(): void {
const c = container.current;
if (c === null) return;
// This number is getTime on 2021-10-15, the reason we need this is to remove a
// large number from getTime so it's value fits in an int32 (from int64).
// The date is arbitrary but it is the date that this "stay-on-top" mechanic was released
// so every future date is guaranteed to be at least after that.
const date = 1634320967207;
// +1500 so it's at least on top of everything else in the game.
c.style.zIndex = new Date().getTime() - date + 1500 + "";
c.style.zIndex = 1500 + layerCounter + "";
layerCounter++;
rerender();
}