mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 16:52:55 +02:00
allbuild commit /usr/bin/git
This commit is contained in:
@@ -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}>
|
||||
|
||||
Reference in New Issue
Block a user