Feature: Disable all automatic zoom_to_fit workflows. Do not take control of users camera. (#6076)

chore: removing all force zoom_to_fit workflows in the system except on initial stream load


sending it
This commit is contained in:
Kevin Nadro
2025-04-03 10:58:18 -05:00
committed by GitHub
parent 74859e99e7
commit 65e08bea92
11 changed files with 24 additions and 87 deletions

View File

@ -428,7 +428,7 @@ export const FileMachineProvider = ({
onSubmit: async (data) => {
if (data.method === 'overwrite') {
codeManager.updateCodeStateEditor(data.code)
await kclManager.executeCode(true)
await kclManager.executeCode()
await codeManager.writeToFile()
} else if (data.method === 'newFile' && isDesktop()) {
send({

View File

@ -273,7 +273,7 @@ const FileTreeItem = ({
await codeManager.writeToFile()
// Prevent seeing the model built one piece at a time when changing files
await kclManager.executeCode(true)
await kclManager.executeCode()
} else {
// Let the lsp servers know we closed a file.
onFileClose(currentFile?.path || null, project?.path || null)

View File

@ -132,7 +132,7 @@ const ProjectsContextWeb = ({ children }: { children: React.ReactNode }) => {
if (err(codeToWrite)) return Promise.reject(codeToWrite)
codeManager.updateCodeStateEditor(codeToWrite)
await codeManager.writeToFile()
await kclManager.executeCode(true)
await kclManager.executeCode()
return {
message: 'File overwritten successfully',

View File

@ -25,6 +25,7 @@ import {
} from '@src/lib/singletons'
import { err, reportRejection } from '@src/lib/trap'
import type { IndexLoaderData } from '@src/lib/types'
import { uuidv4 } from '@src/lib/utils'
import { useSettings } from '@src/machines/appMachine'
import { useCommandBarState } from '@src/machines/commandBarMachine'
@ -67,11 +68,23 @@ export const Stream = () => {
*/
function executeCodeAndPlayStream() {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
kclManager.executeCode(true).then(async () => {
kclManager.executeCode().then(async () => {
await videoRef.current?.play().catch((e) => {
console.warn('Video playing was prevented', e, videoRef.current)
})
setStreamState(StreamState.Playing)
// Only call zoom_to_fit once when the stream starts to center the scene.
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
},
})
})
}