Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions browser_tests/tests/load3d/load3dAgentUpdate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { AgentPanel } from '@e2e/fixtures/components/AgentPanel'
import { load3dAgentTest as test } from '@e2e/fixtures/load3dAgentFixture'
import { Load3DViewerHelper } from '@e2e/tests/load3d/Load3DViewerHelper'

// The 0.5rem gutter the dialog clamp leaves at the viewport edge, and half of
// the 1rem the viewer's own width cap reserves inside the visible workspace.
const VIEWPORT_GUTTER = 8

test.describe('Load3D agent updates', { tag: '@cloud' }, () => {
test.describe.configure({ timeout: 60_000 })

Expand Down Expand Up @@ -69,6 +73,36 @@ test.describe('Load3D agent updates', { tag: '@cloud' }, () => {
await viewer.waitForOpen()
})

await test.step('centre the viewer beside the panel above the sm breakpoint', async () => {
// The viewer keeps its own inset-aware width cap while every other dialog
// now resolves against the raw viewport, and that cap is what holds it on
// the centring branch of the dialog clamp instead of the gutter floor.
// The cap is declared twice — unprefixed and `sm:`-prefixed — because
// tailwind-merge treats those as separate groups, so only the prefixed one
// is live here. The narrow-viewport steps below run under `sm:` and cannot
// see it: drop it and they still pass while the viewer covers the panel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low — The sm:-prefixed copy of the cap is a no-op, so this comment's rationale is inverted: with size: 'full', dialogContentVariants already emits sm:max-w-[calc(100vw-var(--workspace-inset-right,0px)-1rem)], and because w-[80vw] pins the width the used width is min(80vw, 100vw-inset-1rem) with or without the duplicate. Deleting it leaves both the 1280 and 1920 assertions passing rather than letting the viewer cover the panel — only the unprefixed cap is load-bearing, and the 500px step already exercises that. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case).

for (const width of [1280, 1920]) {
await page.setViewportSize({ width, height: 800 })

await expect(async () => {
const dialogBox = await viewer.dialog.boundingBox()
const panelBox = await panel.boundingBox()
expect(dialogBox).not.toBeNull()
expect(panelBox).not.toBeNull()
if (!dialogBox || !panelBox) return

// The panel is docked against the right edge, so its left edge is the
// boundary of the visible workspace.
expect(panelBox.x + panelBox.width).toBeCloseTo(width, 1)
expect(dialogBox.x).toBeCloseTo(VIEWPORT_GUTTER, 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Nit — dialogBox.x === 8 only holds while the inset term of min(80vw, 100vw-inset-1rem) is the smaller one, i.e. while the panel inset exceeds 0.2 * viewport - 16px; that is true at 1280/1920 solely because the panel defaults to PANEL_MIN_WIDTH (420px), and above a ~2180px viewport — or after any step that narrows the panel — the 80vw branch binds and x becomes 32+, failing as a phantom positioning regression. Deriving the expected gutter from the measured panel inset would decouple it (the literal 8 also assumes a 16px root font size). Raised by 2 of 8 reviewers (claude-opus-5-thinking-max edge-case, claude-opus-5-thinking-max adversarial).

expect(dialogBox.x + dialogBox.width).toBeCloseTo(
panelBox.x - VIEWPORT_GUTTER,
1
)
}).toPass({ timeout: 5000 })
}
})

await test.step('keep the viewer outside the docked Agent panel', async () => {
await page.setViewportSize({ width: 500, height: 800 })

Expand Down
7 changes: 2 additions & 5 deletions src/components/load3d/controls/ViewerControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { useI18n } from 'vue-i18n'

import Load3DViewerContent from '@/components/load3d/Load3dViewerContent.vue'
import Button from '@/components/ui/button/Button.vue'
import { LOAD3D_VIEWER_CONTENT_CLASS } from '@/components/load3d/load3dViewerDialog'
import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import { useLoad3dService } from '@/services/load3dService'
import { useDialogStore } from '@/stores/dialogStore'
Expand All @@ -42,10 +42,7 @@ const openIn3DViewer = () => {
component: Load3DViewerContent,
props: props,
dialogComponentProps: {
renderer: 'reka',
size: 'full',
contentClass: LOAD3D_VIEWER_CONTENT_CLASS,
maximizable: true,
...LOAD3D_VIEWER_DIALOG_PROPS,
onClose: async () => {
await useLoad3dService().handleViewerClose(props.node)
}
Expand Down
11 changes: 9 additions & 2 deletions src/components/load3d/load3dViewerDialog.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
export const LOAD3D_VIEWER_CONTENT_CLASS =
'w-[80vw] max-w-[min(80vw,calc(100vw-var(--workspace-inset-right,0px)-1rem))] h-[80vh] max-h-[80vh]'
import type { DialogComponentProps } from '@/stores/dialogStore'

export const LOAD3D_VIEWER_DIALOG_PROPS = {
renderer: 'reka',
size: 'full',
contentClass:
'w-[80vw] max-w-[min(80vw,calc(100vw-var(--workspace-inset-right,0px)-1rem))] sm:max-w-[min(80vw,calc(100vw-var(--workspace-inset-right,0px)-1rem))] h-[80vh] max-h-[80vh]',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium — The inset-aware cap has no lower floor, so while the Agent panel is still docked (it only flips to overlay at roughly <=476px, publishing --workspace-inset-right: 420px) a 500px viewport resolves max-w to 100vw - 420px - 1rem = 64px, leaving an unusable sliver for a viewer whose controls sidebar alone is 288px. The three migrated callers (asset preview, job history, HDR viewer) previously used sm:max-w-[80vw] and stayed usable in that band, so they regress; wrapping the cap in max(20rem, ...) keeps the overlap fix without the degenerate range. Raised by 2 of 8 reviewers (gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max adversarial).

maximizable: true
} satisfies DialogComponentProps
8 changes: 2 additions & 6 deletions src/components/sidebar/tabs/AssetsSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ import {
import { useI18n } from 'vue-i18n'

import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue'
import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog'
import AssetsSidebarGridView from '@/components/sidebar/tabs/AssetsSidebarGridView.vue'
import AssetsSidebarListView from '@/components/sidebar/tabs/AssetsSidebarListView.vue'
import SidebarTabTemplate from '@/components/sidebar/tabs/SidebarTabTemplate.vue'
Expand Down Expand Up @@ -574,12 +575,7 @@ const handleZoomClick = (asset: AssetItem) => {
props: {
modelUrl: getAssetFileUrl(asset)
},
dialogComponentProps: {
renderer: 'reka',
size: 'full',
contentClass: 'left-1/2 w-[80vw] sm:max-w-[80vw] h-[80vh] max-h-[80vh]',
maximizable: true
}
dialogComponentProps: LOAD3D_VIEWER_DIALOG_PROPS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low — This site hands the shared module-level object to the dialog store by reference (as do JobHistorySidebarTab.vue and hdrViewerService.ts) while the other three call sites spread it. It is safe only because createDialog shallow-copies before GlobalDialog.toggleMaximize writes maximized in place and before merge mutates pt; spread consistently or Object.freeze the constant so one viewer's maximize state cannot leak into the others. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case).

})
return
}
Expand Down
8 changes: 2 additions & 6 deletions src/components/sidebar/tabs/JobHistorySidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import { computed, defineAsyncComponent, ref } from 'vue'
import { useI18n } from 'vue-i18n'

import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog'
import JobFilterActions from '@/components/queue/job/JobFilterActions.vue'
import JobFilterTabs from '@/components/queue/job/JobFilterTabs.vue'
import JobAssetsList from '@/components/queue/job/JobAssetsList.vue'
Expand Down Expand Up @@ -189,12 +190,7 @@ const onViewItem = wrapWithErrorHandlingAsync(async (item: JobListItem) => {
props: {
modelUrl: previewOutput.url || ''
},
dialogComponentProps: {
renderer: 'reka',
size: 'full',
contentClass: 'left-1/2 w-[80vw] sm:max-w-[80vw] h-[80vh] max-h-[80vh]',
maximizable: true
}
dialogComponentProps: LOAD3D_VIEWER_DIALOG_PROPS
})
return
}
Expand Down
7 changes: 2 additions & 5 deletions src/extensions/core/load3d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { nextTick } from 'vue'

import Load3D from '@/components/load3d/Load3D.vue'
import Load3DViewerContent from '@/components/load3d/Load3dViewerContent.vue'
import { LOAD3D_VIEWER_CONTENT_CLASS } from '@/components/load3d/load3dViewerDialog'
import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog'
import {
getLoad3dOutputCache,
getLoad3dSceneRevision,
Expand Down Expand Up @@ -286,10 +286,7 @@ useExtensionService().registerExtension({
component: Load3DViewerContent,
props: props,
dialogComponentProps: {
renderer: 'reka',
size: 'full',
contentClass: LOAD3D_VIEWER_CONTENT_CLASS,
maximizable: true,
...LOAD3D_VIEWER_DIALOG_PROPS,
onClose: async () => {
await useLoad3dService().handleViewerClose(props.node)
}
Expand Down
8 changes: 2 additions & 6 deletions src/services/hdrViewerService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineAsyncComponent } from 'vue'

import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog'
import { t } from '@/i18n'
import { useDialogStore } from '@/stores/dialogStore'
import {
Expand All @@ -18,11 +19,6 @@ export function openHdrViewer(url: string) {
title: getImageFilenameFromUrl(fullResUrl) ?? t('hdrViewer.title'),
component: HdrViewerContent,
props: { imageUrl: fullResUrl },
dialogComponentProps: {
renderer: 'reka',
size: 'full',
contentClass: 'left-1/2 w-[80vw] sm:max-w-[80vw] h-[80vh] max-h-[80vh]',
maximizable: true
}
dialogComponentProps: LOAD3D_VIEWER_DIALOG_PROPS
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { computed, defineAsyncComponent, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'

import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog'
import Button from '@/components/ui/button/Button.vue'
import {
findOutputAsset,
Expand Down Expand Up @@ -125,10 +126,7 @@ function inspect(asset: ReplyAsset): void {
component: Load3dViewerContent,
props: { modelUrl: asset.url },
dialogComponentProps: {
renderer: 'reka',
size: 'full',
contentClass: 'left-1/2 w-[80vw] sm:max-w-[80vw] h-[80vh] max-h-[80vh]',
maximizable: true,
...LOAD3D_VIEWER_DIALOG_PROPS,
onClose: () => refreshModelThumbnail(asset)
}
})
Expand Down
Loading