Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: floating monitors stay under the pointer and land without a flash (#16781)
Michael Han04f4f0a75856
diff --git a/studio/frontend/src/components/floating-monitor.tsx b/studio/frontend/src/components/floating-monitor.tsxindex 34746d1e4fe..60c45ae2762 100644--- a/studio/frontend/src/components/floating-monitor.tsx+++ b/studio/frontend/src/components/floating-monitor.tsx@@ -264,7 +264,9 @@ function FloatingMonitorPanel({animate={{ opacity: 1 }}exit={{ opacity: 0 }}className={cn(- "settings-surface bg-background pointer-events-auto absolute flex max-h-full w-64 max-w-full cursor-default select-none flex-col overflow-hidden rounded-2xl border border-border/70 p-3 shadow-border ring-0",+ // transition-none: reduce motion's 0.01ms duration otherwise turns the drop's transform to+ // left/top handoff into a transition, and the compositor paints a frame at the start spot.+ "settings-surface bg-background pointer-events-auto absolute flex max-h-full w-64 transition-none max-w-full cursor-default select-none flex-col overflow-hidden rounded-2xl border border-border/70 p-3 shadow-border ring-0",layout ? "top-0 left-0 resize" : "right-0 bottom-0",)}data-testid="floating-monitor"diff --git a/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx b/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsxindex 3136d85a14c..89a5c483577 100644--- a/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx+++ b/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx@@ -391,7 +391,8 @@ function ApiMonitorPanel({exit={{ opacity: 0 }}/* Panel language from the sidebar menu: soft surface, menu corner, heading font. */className={cn(- "menu-soft-surface pointer-events-auto absolute flex max-h-full w-[calc(400px*var(--ui-space-scale,1))] max-w-full cursor-default select-none flex-col overflow-hidden rounded-xl border-0 p-2.5 font-heading ring-0",+ // transition-none: see floating-monitor.tsx (a drop must not flash at the start spot).+ "menu-soft-surface pointer-events-auto absolute flex max-h-full transition-none w-[calc(400px*var(--ui-space-scale,1))] max-w-full cursor-default select-none flex-col overflow-hidden rounded-xl border-0 p-2.5 font-heading ring-0",// The CSS corner until it has been measured, so the first paint// is the corner it has always opened in rather than the top left.layout ? "top-0 left-0 resize" : "bottom-0 right-0",diff --git a/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx b/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsxindex 9e170c65b81..eb92974b2c6 100644--- a/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx+++ b/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx@@ -339,7 +339,8 @@ export function LoadedModelsIndicator({<divref={panelRef}className={cn(- "pointer-events-none",+ // See floating-monitor.tsx: a drop must not flash at the start spot under reduce motion.+ "pointer-events-none transition-none",position && "fixed z-[9999] w-fit",!position &&(positioneddiff --git a/studio/frontend/src/hooks/use-floating-panel-layout.ts b/studio/frontend/src/hooks/use-floating-panel-layout.tsindex 292eb75e206..9b54d12e042 100644--- a/studio/frontend/src/hooks/use-floating-panel-layout.ts+++ b/studio/frontend/src/hooks/use-floating-panel-layout.ts@@ -171,12 +171,12 @@ export function useFloatingPanelLayout(const maxLeft = Math.max(0, constraintsBox.width - width);const maxTop = Math.max(0, constraintsBox.height - height);const session = dragSessionRef.current;- // Mid-drag the measured box (transform included) is where the pointer has it.+ // Mid-drag the pointer owns the spot: the measured box can be a frame behind it.let left = session- ? clamp(monitorBox.left - constraintsBox.left, 0, maxLeft)+ ? clamp(session.left, 0, maxLeft): placeAxis(intentRef.current.left, maxLeft);let top = session- ? clamp(monitorBox.top - constraintsBox.top, 0, maxTop)+ ? clamp(session.top, 0, maxTop): placeAxis(intentRef.current.top, maxTop);// Obstacle avoidance applies to the first placement only, and a remembered spot wins.if (@@ -381,20 +381,18 @@ export function useFloatingPanelLayout(return;}- const left = clamp(- session.left + event.clientX - session.startX,+ // From the grab point, not the last move: an edge clamp must not eat the overshoot, or the grip+ // slides off the pointer when it comes back.+ session.left = clamp(+ session.baseLeft + event.clientX - session.startX,0,session.maxLeft,);- const top = clamp(- session.top + event.clientY - session.startY,+ session.top = clamp(+ session.baseTop + event.clientY - session.startY,0,session.maxTop,);- session.startX = event.clientX;- session.startY = event.clientY;- session.left = left;- session.top = top;if (!dragFrameRef.current) {dragFrameRef.current = requestAnimationFrame(paintDrag);}diff --git a/studio/frontend/tests/drag-costs-no-render.test.ts b/studio/frontend/tests/drag-costs-no-render.test.tsindex bfa961ab1d9..c4272483797 100644--- a/studio/frontend/tests/drag-costs-no-render.test.ts+++ b/studio/frontend/tests/drag-costs-no-render.test.ts@@ -81,3 +81,26 @@ test("dragging the monitor does not republish its frame per frame", () => {assert.doesNotMatch(update, /setFrame/);assert.doesNotMatch(update, /getBoundingClientRect/);});++test("a drag measures from the grab point, so an edge clamp never slides the grip off the pointer", () => {+ const panel = readSrc("hooks/use-floating-panel-layout.ts");+ const update = panel.slice(+ panel.indexOf("function updateDrag"),+ panel.indexOf("function finishDrag"),+ );+ assert.match(update, /session\.baseLeft \+ event\.clientX - session\.startX/);+ assert.match(update, /session\.baseTop \+ event\.clientY - session\.startY/);+ assert.doesNotMatch(update, /session\.startX = /);+ assert.match(panel, /\? clamp\(session\.left, 0, maxLeft\)/);+ assert.doesNotMatch(panel, /\? clamp\(monitorBox\.left - constraintsBox\.left/);+});++test("dragged panels opt out of reduce motion's transitions, so a drop never flashes at the start", () => {+ for (const path of [+ "components/floating-monitor.tsx",+ "features/api-monitor/api-monitor-overlay.tsx",+ "features/loaded-models/loaded-models-indicator.tsx",+ ]) {+ assert.match(readSrc(path), /"[^"]*\btransition-none\b[^"]*"/, path);+ }+});