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 {
|
||||
const draggableRef = useRef<HTMLDivElement>(null);
|
||||
const rootRef = useRef<Draggable>(null)
|
||||
const rootRef = useRef<Draggable>(null);
|
||||
const [script, setScript] = useState(props.script);
|
||||
const classes = useStyles();
|
||||
const container = useRef<HTMLDivElement>(null);
|
||||
@ -129,22 +129,22 @@ function LogWindow(props: IProps): React.ReactElement {
|
||||
setRerender((old) => !old);
|
||||
}
|
||||
|
||||
useEffect(
|
||||
() =>
|
||||
WorkerScriptStartStopEventEmitter.subscribe(() => {
|
||||
setTimeout(() => {
|
||||
const server = GetServer(script.server);
|
||||
if (server === null) return;
|
||||
const exisitingScript = findRunningScript(script.filename, script.args, server);
|
||||
if (exisitingScript) {
|
||||
exisitingScript.logs = script.logs.concat(exisitingScript.logs)
|
||||
setScript(exisitingScript)
|
||||
}
|
||||
rerender();
|
||||
}, 100)
|
||||
}),
|
||||
[],
|
||||
);
|
||||
// useEffect(
|
||||
// () =>
|
||||
// WorkerScriptStartStopEventEmitter.subscribe(() => {
|
||||
// setTimeout(() => {
|
||||
// const server = GetServer(script.server);
|
||||
// if (server === null) return;
|
||||
// const exisitingScript = findRunningScript(script.filename, script.args, server);
|
||||
// if (exisitingScript) {
|
||||
// exisitingScript.logs = script.logs.concat(exisitingScript.logs)
|
||||
// setScript(exisitingScript)
|
||||
// }
|
||||
// rerender();
|
||||
// }, 100)
|
||||
// }),
|
||||
// [],
|
||||
// );
|
||||
|
||||
useEffect(() => {
|
||||
updateLayer();
|
||||
@ -224,11 +224,8 @@ function LogWindow(props: IProps): React.ReactElement {
|
||||
const isOnScreen = (node: HTMLDivElement): boolean => {
|
||||
const bounds = node.getBoundingClientRect();
|
||||
|
||||
return !(bounds.right < 0 ||
|
||||
bounds.bottom < 0 ||
|
||||
bounds.left > innerWidth ||
|
||||
bounds.top > outerWidth);
|
||||
}
|
||||
return !(bounds.right < 0 || bounds.bottom < 0 || bounds.left > innerWidth || bounds.top > outerWidth);
|
||||
};
|
||||
|
||||
const resetPosition = (): void => {
|
||||
const node = rootRef?.current;
|
||||
@ -237,14 +234,11 @@ function LogWindow(props: IProps): React.ReactElement {
|
||||
state.x = 0;
|
||||
state.y = 0;
|
||||
node.setState(state);
|
||||
}
|
||||
};
|
||||
|
||||
const boundToBody = (e: any): void | false => {
|
||||
if (e.clientX < 0 ||
|
||||
e.clientY < 0 ||
|
||||
e.clientX > innerWidth ||
|
||||
e.clientY > innerHeight) return false;
|
||||
}
|
||||
if (e.clientX < 0 || e.clientY < 0 || e.clientX > innerWidth || e.clientY > innerHeight) return false;
|
||||
};
|
||||
|
||||
return (
|
||||
<Draggable handle=".drag" onDrag={boundToBody} ref={rootRef}>
|
||||
|
Loading…
Reference in New Issue
Block a user