mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
commit
c793965a4b
26
dist/vendor.bundle.js
vendored
26
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/vendor.bundle.js.map
vendored
2
dist/vendor.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -119,7 +119,7 @@ export const logBoxBaseZIndex = 1500;
|
|||||||
|
|
||||||
function LogWindow(props: IProps): React.ReactElement {
|
function LogWindow(props: IProps): React.ReactElement {
|
||||||
const draggableRef = useRef<HTMLDivElement>(null);
|
const draggableRef = useRef<HTMLDivElement>(null);
|
||||||
const rootRef = useRef<Draggable>(null)
|
const rootRef = useRef<Draggable>(null);
|
||||||
const [script, setScript] = useState(props.script);
|
const [script, setScript] = useState(props.script);
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const container = useRef<HTMLDivElement>(null);
|
const container = useRef<HTMLDivElement>(null);
|
||||||
@ -129,22 +129,22 @@ function LogWindow(props: IProps): React.ReactElement {
|
|||||||
setRerender((old) => !old);
|
setRerender((old) => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(
|
// useEffect(
|
||||||
() =>
|
// () =>
|
||||||
WorkerScriptStartStopEventEmitter.subscribe(() => {
|
// WorkerScriptStartStopEventEmitter.subscribe(() => {
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
const server = GetServer(script.server);
|
// const server = GetServer(script.server);
|
||||||
if (server === null) return;
|
// if (server === null) return;
|
||||||
const exisitingScript = findRunningScript(script.filename, script.args, server);
|
// const exisitingScript = findRunningScript(script.filename, script.args, server);
|
||||||
if (exisitingScript) {
|
// if (exisitingScript) {
|
||||||
exisitingScript.logs = script.logs.concat(exisitingScript.logs)
|
// exisitingScript.logs = script.logs.concat(exisitingScript.logs)
|
||||||
setScript(exisitingScript)
|
// setScript(exisitingScript)
|
||||||
}
|
// }
|
||||||
rerender();
|
// rerender();
|
||||||
}, 100)
|
// }, 100)
|
||||||
}),
|
// }),
|
||||||
[],
|
// [],
|
||||||
);
|
// );
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
updateLayer();
|
updateLayer();
|
||||||
@ -224,11 +224,8 @@ function LogWindow(props: IProps): React.ReactElement {
|
|||||||
const isOnScreen = (node: HTMLDivElement): boolean => {
|
const isOnScreen = (node: HTMLDivElement): boolean => {
|
||||||
const bounds = node.getBoundingClientRect();
|
const bounds = node.getBoundingClientRect();
|
||||||
|
|
||||||
return !(bounds.right < 0 ||
|
return !(bounds.right < 0 || bounds.bottom < 0 || bounds.left > innerWidth || bounds.top > outerWidth);
|
||||||
bounds.bottom < 0 ||
|
};
|
||||||
bounds.left > innerWidth ||
|
|
||||||
bounds.top > outerWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
const resetPosition = (): void => {
|
const resetPosition = (): void => {
|
||||||
const node = rootRef?.current;
|
const node = rootRef?.current;
|
||||||
@ -237,14 +234,11 @@ function LogWindow(props: IProps): React.ReactElement {
|
|||||||
state.x = 0;
|
state.x = 0;
|
||||||
state.y = 0;
|
state.y = 0;
|
||||||
node.setState(state);
|
node.setState(state);
|
||||||
}
|
};
|
||||||
|
|
||||||
const boundToBody = (e: any): void | false => {
|
const boundToBody = (e: any): void | false => {
|
||||||
if (e.clientX < 0 ||
|
if (e.clientX < 0 || e.clientY < 0 || e.clientX > innerWidth || e.clientY > innerHeight) return false;
|
||||||
e.clientY < 0 ||
|
};
|
||||||
e.clientX > innerWidth ||
|
|
||||||
e.clientY > innerHeight) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Draggable handle=".drag" onDrag={boundToBody} ref={rootRef}>
|
<Draggable handle=".drag" onDrag={boundToBody} ref={rootRef}>
|
||||||
|
Loading…
Reference in New Issue
Block a user