set-initial-window-debugger-position-size-as-specified-in-the (#3139)
This commit is contained in:
@@ -145,6 +145,7 @@ function getOs(): OS {
|
|||||||
function FloatingWindow({
|
function FloatingWindow({
|
||||||
bounded,
|
bounded,
|
||||||
children,
|
children,
|
||||||
|
initialPosition,
|
||||||
initialWidth,
|
initialWidth,
|
||||||
initialHeight,
|
initialHeight,
|
||||||
maximized,
|
maximized,
|
||||||
@@ -162,6 +163,7 @@ function FloatingWindow({
|
|||||||
bounded?: boolean;
|
bounded?: boolean;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
initialHeight?: number;
|
initialHeight?: number;
|
||||||
|
initialPosition?: { x: number; y: number };
|
||||||
initialWidth?: number;
|
initialWidth?: number;
|
||||||
maximized?: boolean;
|
maximized?: boolean;
|
||||||
showCloseButton?: boolean;
|
showCloseButton?: boolean;
|
||||||
@@ -177,22 +179,22 @@ function FloatingWindow({
|
|||||||
}) {
|
}) {
|
||||||
const [reloadKey, setReloadKey] = useState(0);
|
const [reloadKey, setReloadKey] = useState(0);
|
||||||
const [isReloading, setIsReloading] = useState(false);
|
const [isReloading, setIsReloading] = useState(false);
|
||||||
const [position, setPosition] = useState({ x: 0, y: 0 });
|
const [position, setPosition] = useState(initialPosition ?? { x: 0, y: 0 });
|
||||||
const [size, setSize] = useState({
|
const [size, setSize] = useState({
|
||||||
left: 0,
|
left: initialPosition?.x ?? 0,
|
||||||
top: 0,
|
top: initialPosition?.y ?? 0,
|
||||||
height: initialHeight ?? Constants.MinHeight,
|
height: initialHeight ?? Constants.MinHeight,
|
||||||
width: initialWidth ?? Constants.MinWidth,
|
width: initialWidth ?? Constants.MinWidth,
|
||||||
});
|
});
|
||||||
const [lastSize, setLastSize] = useState({
|
const [lastSize, setLastSize] = useState({
|
||||||
left: 0,
|
left: initialPosition?.x ?? 0,
|
||||||
top: 0,
|
top: initialPosition?.y ?? 0,
|
||||||
height: initialHeight ?? Constants.MinHeight,
|
height: initialHeight ?? Constants.MinHeight,
|
||||||
width: initialWidth ?? Constants.MinWidth,
|
width: initialWidth ?? Constants.MinWidth,
|
||||||
});
|
});
|
||||||
const [restoreSize, setRestoreSize] = useState({
|
const [restoreSize, setRestoreSize] = useState({
|
||||||
left: 0,
|
left: initialPosition?.x ?? 0,
|
||||||
top: 0,
|
top: initialPosition?.y ?? 0,
|
||||||
height: initialHeight ?? Constants.MinHeight,
|
height: initialHeight ?? Constants.MinHeight,
|
||||||
width: initialWidth ?? Constants.MinWidth,
|
width: initialWidth ?? Constants.MinWidth,
|
||||||
});
|
});
|
||||||
@@ -286,13 +288,13 @@ function FloatingWindow({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSize({
|
setSize({
|
||||||
left: 0,
|
left: initialPosition?.x ?? 0,
|
||||||
top: 0,
|
top: initialPosition?.y ?? 0,
|
||||||
width: initialWidth,
|
width: initialWidth,
|
||||||
height: initialHeight,
|
height: initialHeight,
|
||||||
});
|
});
|
||||||
setPosition({ x: 0, y: 0 });
|
setPosition({ x: initialPosition?.x ?? 0, y: initialPosition?.y ?? 0 });
|
||||||
}, [initialWidth, initialHeight]);
|
}, [initialWidth, initialHeight, initialPosition]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forces the sizing to take place after the resize is complete.
|
* Forces the sizing to take place after the resize is complete.
|
||||||
|
|||||||
@@ -186,6 +186,21 @@ function WorkflowDebugger() {
|
|||||||
const interactor = workflowRun && isFinalized === false ? "agent" : "human";
|
const interactor = workflowRun && isFinalized === false ? "agent" : "human";
|
||||||
const browserTitle = interactor === "agent" ? `Browser [🤖]` : `Browser [👤]`;
|
const browserTitle = interactor === "agent" ? `Browser [🤖]` : `Browser [👤]`;
|
||||||
|
|
||||||
|
// ---start fya: https://github.com/frontyardart
|
||||||
|
const initialBrowserPosition = {
|
||||||
|
x: 600,
|
||||||
|
y: 132,
|
||||||
|
};
|
||||||
|
|
||||||
|
const windowWidth = window.innerWidth;
|
||||||
|
const rightPadding = 567;
|
||||||
|
const initialWidth = Math.max(
|
||||||
|
512,
|
||||||
|
windowWidth - initialBrowserPosition.x - rightPadding,
|
||||||
|
);
|
||||||
|
const initialHeight = (initialWidth / 16) * 9;
|
||||||
|
// ---end fya
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative flex h-screen w-full">
|
<div className="relative flex h-screen w-full">
|
||||||
<Dialog
|
<Dialog
|
||||||
@@ -247,8 +262,9 @@ function WorkflowDebugger() {
|
|||||||
<FloatingWindow
|
<FloatingWindow
|
||||||
title={browserTitle}
|
title={browserTitle}
|
||||||
bounded={false}
|
bounded={false}
|
||||||
initialWidth={512}
|
initialPosition={initialBrowserPosition}
|
||||||
initialHeight={360}
|
initialWidth={initialWidth}
|
||||||
|
initialHeight={initialHeight}
|
||||||
showMaximizeButton={true}
|
showMaximizeButton={true}
|
||||||
showMinimizeButton={true}
|
showMinimizeButton={true}
|
||||||
showPowerButton={blockLabel === undefined && showPowerButton}
|
showPowerButton={blockLabel === undefined && showPowerButton}
|
||||||
|
|||||||
Reference in New Issue
Block a user