Merge pull request #3273 from danielyxie/dev

Remove tail window search
This commit is contained in:
hydroflame
2022-03-29 17:20:20 -04:00
committed by GitHub
5 changed files with 39 additions and 45 deletions

26
dist/vendor.bundle.js 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

File diff suppressed because one or more lines are too long

View File

@ -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}>