Fix zoom to fit being frigged

This commit is contained in:
lee-at-zoo-corp
2025-04-03 17:31:51 -04:00
parent 70f9c8edf1
commit 4c57cea22d
2 changed files with 17 additions and 0 deletions

View File

@ -75,6 +75,7 @@ test.describe('Point and click for boolean workflows', () => {
// Select first object in the scene, expect there to be a pixel diff from the selection color change // Select first object in the scene, expect there to be a pixel diff from the selection color change
await clickFirstObject({ pixelDiff: 50 }) await clickFirstObject({ pixelDiff: 50 })
await page.waitForTimeout(1000)
// For subtract, we need to proceed to the next step before selecting the second object // For subtract, we need to proceed to the next step before selecting the second object
if (operationName !== 'subtract') { if (operationName !== 'subtract') {
@ -85,6 +86,8 @@ test.describe('Point and click for boolean workflows', () => {
// Select second object // Select second object
await clickSecondObject({ pixelDiff: 50 }) await clickSecondObject({ pixelDiff: 50 })
await page.waitForTimeout(1000)
// Confirm the operation in the command bar // Confirm the operation in the command bar
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()

View File

@ -5,6 +5,7 @@ import {
rustContext, rustContext,
sceneInfra, sceneInfra,
} from '@src/lib/singletons' } from '@src/lib/singletons'
import { uuidv4 } from '@src/lib/utils'
import type { MutableRefObject } from 'react' import type { MutableRefObject } from 'react'
import type { ActorRefFrom } from 'xstate' import type { ActorRefFrom } from 'xstate'
import { assign, fromPromise, setup } from 'xstate' import { assign, fromPromise, setup } from 'xstate'
@ -120,6 +121,19 @@ export const engineStreamMachine = setup({
.catch(console.warn) .catch(console.warn)
await kclManager.executeCode() await kclManager.executeCode()
if (params.zoomToFit) {
await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
type: 'zoom_to_fit',
object_ids: [], // leave empty to zoom to all objects
padding: 0.1, // padding around the objects
animated: false, // don't animate the zoom for now
},
})
}
} }
), ),
[EngineStreamTransition.Pause]: fromPromise( [EngineStreamTransition.Pause]: fromPromise(