Repository navigation
[backport core/1.55] fix(load3d): apply workspace inset to every viewer #20137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 }) | ||
|
|
||
|
|
@@ -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. | ||
| 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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Nit — |
||
| 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 }) | ||
|
|
||
|
|
||
| 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]', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| maximizable: true | ||
| } satisfies DialogComponentProps | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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' | ||
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| }) | ||
| return | ||
| } | ||
|
|
||
There was a problem hiding this comment.
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: withsize: 'full',dialogContentVariantsalready emitssm:max-w-[calc(100vw-var(--workspace-inset-right,0px)-1rem)], and becausew-[80vw]pins the width the used width ismin(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).