diff --git a/src/clientSideScene/CameraControls.ts b/src/clientSideScene/CameraControls.ts index 82c766bc1..81765b911 100644 --- a/src/clientSideScene/CameraControls.ts +++ b/src/clientSideScene/CameraControls.ts @@ -275,11 +275,6 @@ export class CameraControls { >[0] const cb = ({ data, type }: CallBackParam) => { - // We're reconnecting, so ignore this init proces. - if (this.oldCameraState) { - return - } - const camSettings = data.settings this.camera.position.set( camSettings.pos.x, @@ -965,16 +960,16 @@ export class CameraControls { } async restoreRemoteCameraStateAndTriggerSync() { - if (!this.oldCameraState) return - - await this.engineCommandManager.sendSceneCommand({ - type: 'modeling_cmd_req', - cmd_id: uuidv4(), - cmd: { - type: 'default_camera_set_view', - view: this.oldCameraState, - }, - }) + if (this.oldCameraState) { + await this.engineCommandManager.sendSceneCommand({ + type: 'modeling_cmd_req', + cmd_id: uuidv4(), + cmd: { + type: 'default_camera_set_view', + view: this.oldCameraState, + }, + }) + } await this.engineCommandManager.sendSceneCommand({ type: 'modeling_cmd_req', diff --git a/src/lang/std/engineConnection.ts b/src/lang/std/engineConnection.ts index 018f2edcc..4f8e3c8e9 100644 --- a/src/lang/std/engineConnection.ts +++ b/src/lang/std/engineConnection.ts @@ -1494,6 +1494,7 @@ export class EngineCommandManager extends EventTarget { }) this._camControlsCameraChange() + // eslint-disable-next-line @typescript-eslint/no-floating-promises this.sendSceneCommand({ // CameraControls subscribes to default_camera_get_settings response events @@ -1504,6 +1505,7 @@ export class EngineCommandManager extends EventTarget { type: 'default_camera_get_settings', }, }) + setIsStreamReady(true) // Other parts of the application should use this to react on scene ready. @@ -1717,7 +1719,7 @@ export class EngineCommandManager extends EventTarget { cmd: { type: 'reconfigure_stream', ...this.streamDimensions, - fps: 30, + fps: 60, // This is required but it does next to nothing }, } this.engineConnection?.send(resizeCmd) diff --git a/src/lib/settings/initialSettings.tsx b/src/lib/settings/initialSettings.tsx index 4694ff15a..0f3f4d650 100644 --- a/src/lib/settings/initialSettings.tsx +++ b/src/lib/settings/initialSettings.tsx @@ -219,16 +219,32 @@ export function createSettings() { (typeof v === 'number' && v >= 1 * MS_IN_MINUTE && v <= 60 * MS_IN_MINUTE), - Component: ({ value, updateValue }) => ( + Component: ({ value: settingValueInStorage, updateValue: writeSettingValueToStorage }) => { + const [timeoutId, setTimeoutId] = useState(undefined) + const [preview, setPreview] = useState(settingValueInStorage === undefined ? settingValueInStorage : (settingValueInStorage / MS_IN_MINUTE)) + const onChangeRange = (e: React.SyntheticEvent) => setPreview(e.currentTarget.value) + const onSaveRange = (e: React.SyntheticEvent) => { + if (preview === undefined) return + writeSettingValueToStorage(Number(e.currentTarget.value) * MS_IN_MINUTE) + } + + return (