redo 6035 because of 6036, which undid 6035 (#3302)
This commit is contained in:
@@ -334,7 +334,7 @@ function BrowserStream({
|
||||
ref={setCanvasContainerRef}
|
||||
>
|
||||
{isVncConnected && (
|
||||
<div className="overlay z-10 flex items-center justify-center">
|
||||
<div className="overlay z-10 flex items-center justify-center overflow-hidden">
|
||||
{showControlButtons && (
|
||||
<div className="control-buttons pointer-events-none relative flex h-full w-full items-center justify-center">
|
||||
<Button
|
||||
|
||||
@@ -31,6 +31,7 @@ import { PowerIcon } from "./icons/PowerIcon";
|
||||
type OS = "Windows" | "macOS" | "Linux" | "Unknown";
|
||||
|
||||
const Constants = {
|
||||
HandleSize: "40px",
|
||||
MinHeight: 52,
|
||||
MinWidth: 256,
|
||||
} as const;
|
||||
@@ -180,11 +181,14 @@ function FloatingWindow({
|
||||
title,
|
||||
zIndex,
|
||||
// --
|
||||
onBlur,
|
||||
onBreakout,
|
||||
onCycle,
|
||||
onFocus,
|
||||
onBlur,
|
||||
onInteract,
|
||||
onMinimize,
|
||||
onMaximize,
|
||||
onRestore,
|
||||
}: {
|
||||
bounded?: boolean;
|
||||
children: React.ReactNode;
|
||||
@@ -201,11 +205,14 @@ function FloatingWindow({
|
||||
title: string;
|
||||
zIndex?: number;
|
||||
// --
|
||||
onBlur?: () => void;
|
||||
onBreakout?: () => void;
|
||||
onCycle?: () => void;
|
||||
onFocus?: () => void;
|
||||
onBlur?: () => void;
|
||||
onInteract?: () => void;
|
||||
onMinimize?: () => void;
|
||||
onMaximize?: () => void;
|
||||
onRestore?: () => void;
|
||||
}) {
|
||||
const [reloadKey, setReloadKey] = useState(0);
|
||||
const [isReloading, setIsReloading] = useState(false);
|
||||
@@ -424,6 +431,8 @@ function FloatingWindow({
|
||||
});
|
||||
|
||||
setPosition({ x: 0, y: 0 });
|
||||
|
||||
onMaximize?.();
|
||||
};
|
||||
|
||||
const minimize = () => {
|
||||
@@ -459,6 +468,8 @@ function FloatingWindow({
|
||||
});
|
||||
|
||||
setPosition({ x: left, y: top });
|
||||
|
||||
onMinimize?.();
|
||||
};
|
||||
|
||||
const restore = () => {
|
||||
@@ -480,6 +491,8 @@ function FloatingWindow({
|
||||
|
||||
setIsMaximized(false);
|
||||
setIsMinimized(false);
|
||||
|
||||
onRestore?.();
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
@@ -571,12 +584,14 @@ function FloatingWindow({
|
||||
})}
|
||||
handleStyles={{
|
||||
bottomLeft: {
|
||||
width: "40px",
|
||||
height: "40px",
|
||||
width: isMinimized || isMaximized ? "0px" : Constants.HandleSize,
|
||||
height: isMinimized || isMaximized ? "0px" : Constants.HandleSize,
|
||||
zIndex: 20,
|
||||
},
|
||||
bottomRight: {
|
||||
width: "40px",
|
||||
height: "40px",
|
||||
width: isMinimized || isMaximized ? "0px" : Constants.HandleSize,
|
||||
height: isMinimized || isMaximized ? "0px" : Constants.HandleSize,
|
||||
zIndex: 20,
|
||||
},
|
||||
}}
|
||||
minHeight={Constants.MinHeight}
|
||||
|
||||
@@ -127,6 +127,7 @@ function Workspace({
|
||||
"history",
|
||||
"infiniteCanvas",
|
||||
]);
|
||||
const [hideControlButtons, setHideControlButtons] = useState(false);
|
||||
|
||||
// ---start fya: https://github.com/frontyardart
|
||||
const hasForLoopNode = nodes.some((node) => node.type === "loop");
|
||||
@@ -799,6 +800,15 @@ function Workspace({
|
||||
onBreakout={handleOnBreakout}
|
||||
onCycle={handleOnCycle}
|
||||
onFocus={() => promote("browserWindow")}
|
||||
onMinimize={() => {
|
||||
setHideControlButtons(true);
|
||||
}}
|
||||
onMaximize={() => {
|
||||
setHideControlButtons(false);
|
||||
}}
|
||||
onRestore={() => {
|
||||
setHideControlButtons(false);
|
||||
}}
|
||||
>
|
||||
{activeDebugSession &&
|
||||
activeDebugSession.browser_session_id &&
|
||||
@@ -806,7 +816,7 @@ function Workspace({
|
||||
<BrowserStream
|
||||
interactive={false}
|
||||
browserSessionId={activeDebugSession.browser_session_id}
|
||||
showControlButtons={true}
|
||||
showControlButtons={!hideControlButtons}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex h-full w-full flex-col items-center justify-center gap-2 pb-2 pt-4 text-sm text-slate-400">
|
||||
|
||||
Reference in New Issue
Block a user