yarn fmt
This commit is contained in:
@ -981,17 +981,21 @@ export class CameraControls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async saveRemoteCameraState() {
|
async saveRemoteCameraState() {
|
||||||
const cameraViewStateResponse = await this.engineCommandManager.sendSceneCommand({
|
const cameraViewStateResponse =
|
||||||
|
await this.engineCommandManager.sendSceneCommand({
|
||||||
type: 'modeling_cmd_req',
|
type: 'modeling_cmd_req',
|
||||||
cmd_id: uuidv4(),
|
cmd_id: uuidv4(),
|
||||||
cmd: { type: 'default_camera_get_view' },
|
cmd: { type: 'default_camera_get_view' },
|
||||||
})
|
})
|
||||||
if (!cameraViewStateResponse) return
|
if (!cameraViewStateResponse) return
|
||||||
if ('resp' in cameraViewStateResponse
|
if (
|
||||||
&& 'modeling_response' in cameraViewStateResponse.resp.data
|
'resp' in cameraViewStateResponse &&
|
||||||
&& 'data' in cameraViewStateResponse.resp.data.modeling_response
|
'modeling_response' in cameraViewStateResponse.resp.data &&
|
||||||
&& 'view' in cameraViewStateResponse.resp.data.modeling_response.data) {
|
'data' in cameraViewStateResponse.resp.data.modeling_response &&
|
||||||
this.oldCameraState = cameraViewStateResponse.resp.data.modeling_response.data.view
|
'view' in cameraViewStateResponse.resp.data.modeling_response.data
|
||||||
|
) {
|
||||||
|
this.oldCameraState =
|
||||||
|
cameraViewStateResponse.resp.data.modeling_response.data.view
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,7 @@ import { useEngineCommands } from '@src/components/EngineCommands'
|
|||||||
import { Spinner } from '@src/components/Spinner'
|
import { Spinner } from '@src/components/Spinner'
|
||||||
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||||
import {
|
import { faPlay, faPause, faSpinner } from '@fortawesome/free-solid-svg-icons'
|
||||||
faPlay,
|
|
||||||
faPause,
|
|
||||||
faSpinner,
|
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
|
||||||
|
|
||||||
export const ModelStateIndicator = () => {
|
export const ModelStateIndicator = () => {
|
||||||
const engineStreamState = useSelector(engineStreamActor, (state) => state)
|
const engineStreamState = useSelector(engineStreamActor, (state) => state)
|
||||||
@ -18,12 +14,14 @@ export const ModelStateIndicator = () => {
|
|||||||
|
|
||||||
if (engineStreamState.value === EngineStreamState.Paused) {
|
if (engineStreamState.value === EngineStreamState.Paused) {
|
||||||
className += 'text-secondary'
|
className += 'text-secondary'
|
||||||
icon = <FontAwesomeIcon
|
icon = (
|
||||||
|
<FontAwesomeIcon
|
||||||
data-testid={dataTestId + '-paused'}
|
data-testid={dataTestId + '-paused'}
|
||||||
icon={faPause}
|
icon={faPause}
|
||||||
width="20"
|
width="20"
|
||||||
height="20"
|
height="20"
|
||||||
/>
|
/>
|
||||||
|
)
|
||||||
} else if (engineStreamState.value === EngineStreamState.Playing) {
|
} else if (engineStreamState.value === EngineStreamState.Playing) {
|
||||||
className += 'text-secondary'
|
className += 'text-secondary'
|
||||||
icon = (
|
icon = (
|
||||||
@ -36,12 +34,14 @@ export const ModelStateIndicator = () => {
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
className += 'text-secondary'
|
className += 'text-secondary'
|
||||||
icon = <FontAwesomeIcon
|
icon = (
|
||||||
|
<FontAwesomeIcon
|
||||||
data-testid={dataTestId + '-resuming'}
|
data-testid={dataTestId + '-resuming'}
|
||||||
icon={faSpinner}
|
icon={faSpinner}
|
||||||
width="20"
|
width="20"
|
||||||
height="20"
|
height="20"
|
||||||
/>
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -86,7 +86,7 @@ export const NetworkHealthIndicator = () => {
|
|||||||
error,
|
error,
|
||||||
setHasCopied,
|
setHasCopied,
|
||||||
hasCopied,
|
hasCopied,
|
||||||
ping
|
ping,
|
||||||
} = useNetworkContext()
|
} = useNetworkContext()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -130,10 +130,12 @@ export const NetworkHealthIndicator = () => {
|
|||||||
{NETWORK_HEALTH_TEXT[overallState]}
|
{NETWORK_HEALTH_TEXT[overallState]}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div className={`flex items-center justify-between p-2 rounded-t-sm`}>
|
||||||
className={`flex items-center justify-between p-2 rounded-t-sm`}
|
<h2
|
||||||
|
className={`text-xs font-sans font-normal ${overallConnectionStateColor[overallState].icon}`}
|
||||||
>
|
>
|
||||||
<h2 className={`text-xs font-sans font-normal ${overallConnectionStateColor[overallState].icon}`}>Ping</h2>
|
Ping
|
||||||
|
</h2>
|
||||||
<p
|
<p
|
||||||
data-testid="network"
|
data-testid="network"
|
||||||
className={`font-bold text-xs uppercase px-2 py-1 rounded-sm ${overallConnectionStateColor[overallState].icon}`}
|
className={`font-bold text-xs uppercase px-2 py-1 rounded-sm ${overallConnectionStateColor[overallState].icon}`}
|
||||||
|
@ -71,7 +71,7 @@ export function useNetworkStatus() {
|
|||||||
? NetworkHealthState.Disconnected
|
? NetworkHealthState.Disconnected
|
||||||
: hasIssues || hasIssues === undefined
|
: hasIssues || hasIssues === undefined
|
||||||
? NetworkHealthState.Issue
|
? NetworkHealthState.Issue
|
||||||
: ping > (16.6*3) // we consider ping longer than 3 frames as weak
|
: ping > 16.6 * 3 // we consider ping longer than 3 frames as weak
|
||||||
? NetworkHealthState.Weak
|
? NetworkHealthState.Weak
|
||||||
: NetworkHealthState.Ok
|
: NetworkHealthState.Ok
|
||||||
)
|
)
|
||||||
|
@ -332,15 +332,19 @@ class EngineConnection extends EventTarget {
|
|||||||
|
|
||||||
this.pingIntervalId = setInterval(() => {
|
this.pingIntervalId = setInterval(() => {
|
||||||
// Only start a new ping when the other is fulfilled.
|
// Only start a new ping when the other is fulfilled.
|
||||||
if (this.pingPongSpan.ping) { return }
|
if (this.pingPongSpan.ping) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Don't start pinging until we're connected.
|
// Don't start pinging until we're connected.
|
||||||
if (this.state.type !== EngineConnectionStateType.ConnectionEstablished) { return }
|
if (this.state.type !== EngineConnectionStateType.ConnectionEstablished) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.send({ type: 'ping' })
|
this.send({ type: 'ping' })
|
||||||
this.pingPongSpan = {
|
this.pingPongSpan = {
|
||||||
ping: new Date(),
|
ping: new Date(),
|
||||||
pong: undefined
|
pong: undefined,
|
||||||
}
|
}
|
||||||
}, pingIntervalMs)
|
}, pingIntervalMs)
|
||||||
|
|
||||||
@ -1000,7 +1004,10 @@ class EngineConnection extends EventTarget {
|
|||||||
this.pingPongSpan.pong = new Date()
|
this.pingPongSpan.pong = new Date()
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new CustomEvent(EngineConnectionEvents.PingPongChanged, {
|
new CustomEvent(EngineConnectionEvents.PingPongChanged, {
|
||||||
detail: Math.min(999, Math.floor(this.pingPongSpan.pong - this.pingPongSpan.ping)),
|
detail: Math.min(
|
||||||
|
999,
|
||||||
|
Math.floor(this.pingPongSpan.pong - this.pingPongSpan.ping)
|
||||||
|
),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
// Clear the initial ping so our interval ping loop can fire again
|
// Clear the initial ping so our interval ping loop can fire again
|
||||||
|
@ -219,13 +219,23 @@ export function createSettings() {
|
|||||||
(typeof v === 'number' &&
|
(typeof v === 'number' &&
|
||||||
v >= 1 * MS_IN_MINUTE &&
|
v >= 1 * MS_IN_MINUTE &&
|
||||||
v <= 60 * MS_IN_MINUTE),
|
v <= 60 * MS_IN_MINUTE),
|
||||||
Component: ({ value: settingValueInStorage, updateValue: writeSettingValueToStorage }) => {
|
Component: ({
|
||||||
|
value: settingValueInStorage,
|
||||||
|
updateValue: writeSettingValueToStorage,
|
||||||
|
}) => {
|
||||||
const [timeoutId, setTimeoutId] = useState(undefined)
|
const [timeoutId, setTimeoutId] = useState(undefined)
|
||||||
const [preview, setPreview] = useState(settingValueInStorage === undefined ? settingValueInStorage : (settingValueInStorage / MS_IN_MINUTE))
|
const [preview, setPreview] = useState(
|
||||||
const onChangeRange = (e: React.SyntheticEvent) => setPreview(e.currentTarget.value)
|
settingValueInStorage === undefined
|
||||||
|
? settingValueInStorage
|
||||||
|
: settingValueInStorage / MS_IN_MINUTE
|
||||||
|
)
|
||||||
|
const onChangeRange = (e: React.SyntheticEvent) =>
|
||||||
|
setPreview(e.currentTarget.value)
|
||||||
const onSaveRange = (e: React.SyntheticEvent) => {
|
const onSaveRange = (e: React.SyntheticEvent) => {
|
||||||
if (preview === undefined) return
|
if (preview === undefined) return
|
||||||
writeSettingValueToStorage(Number(e.currentTarget.value) * MS_IN_MINUTE)
|
writeSettingValueToStorage(
|
||||||
|
Number(e.currentTarget.value) * MS_IN_MINUTE
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -235,17 +245,24 @@ export function createSettings() {
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={settingValueInStorage !== undefined}
|
checked={settingValueInStorage !== undefined}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
if (timeoutId) { return }
|
if (timeoutId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const isChecked = event.currentTarget.checked
|
const isChecked = event.currentTarget.checked
|
||||||
clearTimeout(timeoutId)
|
clearTimeout(timeoutId)
|
||||||
setTimeoutId(setTimeout(() => {
|
setTimeoutId(
|
||||||
|
setTimeout(() => {
|
||||||
const requested = !isChecked ? undefined : 5
|
const requested = !isChecked ? undefined : 5
|
||||||
setPreview(requested)
|
setPreview(requested)
|
||||||
writeSettingValueToStorage(requested === undefined ? undefined : Number(requested) * MS_IN_MINUTE)
|
writeSettingValueToStorage(
|
||||||
|
requested === undefined
|
||||||
|
? undefined
|
||||||
|
: Number(requested) * MS_IN_MINUTE
|
||||||
|
)
|
||||||
setTimeoutId(undefined)
|
setTimeoutId(undefined)
|
||||||
}, 100))
|
}, 100)
|
||||||
}
|
)
|
||||||
}
|
}}
|
||||||
className="block w-4 h-4"
|
className="block w-4 h-4"
|
||||||
/>
|
/>
|
||||||
<div></div>
|
<div></div>
|
||||||
@ -259,9 +276,7 @@ export function createSettings() {
|
|||||||
onPointerUp={onSaveRange}
|
onPointerUp={onSaveRange}
|
||||||
disabled={preview === undefined}
|
disabled={preview === undefined}
|
||||||
value={
|
value={
|
||||||
preview !== null && preview !== undefined
|
preview !== null && preview !== undefined ? preview : 5
|
||||||
? preview
|
|
||||||
: 5
|
|
||||||
}
|
}
|
||||||
min={1}
|
min={1}
|
||||||
max={60}
|
max={60}
|
||||||
@ -279,7 +294,8 @@ export function createSettings() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
allowOrbitInSketchMode: new Setting<boolean>({
|
allowOrbitInSketchMode: new Setting<boolean>({
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
|
@ -118,9 +118,7 @@ export const engineStreamMachine = setup({
|
|||||||
// will not reexecute.
|
// will not reexecute.
|
||||||
// When calling cache before _any_ executions it errors, but non-fatal.
|
// When calling cache before _any_ executions it errors, but non-fatal.
|
||||||
await rustContext
|
await rustContext
|
||||||
.clearSceneAndBustCache(
|
.clearSceneAndBustCache({ settings: await jsAppSettings() })
|
||||||
{ settings: await jsAppSettings() },
|
|
||||||
)
|
|
||||||
.catch(console.warn)
|
.catch(console.warn)
|
||||||
|
|
||||||
await kclManager.executeCode(params.zoomToFit)
|
await kclManager.executeCode(params.zoomToFit)
|
||||||
|
Reference in New Issue
Block a user