wait to execute code until planes are ready (#830)

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2023-10-11 10:40:54 -07:00
committed by GitHub
parent 6c15a743a2
commit 8ad1476c13
2 changed files with 8 additions and 0 deletions

View File

@ -185,6 +185,7 @@ class KclManager {
async executeCode(code?: string) { async executeCode(code?: string) {
await initPromise await initPromise
await this?.engineCommandManager?.waitForReady await this?.engineCommandManager?.waitForReady
if (!this?.engineCommandManager?.planesInitialized()) return
const result = await executeCode({ const result = await executeCode({
engineCommandManager, engineCommandManager,
code: code || this._code, code: code || this._code,

View File

@ -1221,6 +1221,13 @@ export class EngineCommandManager {
}, },
}) })
} }
planesInitialized(): boolean {
return (
this.defaultPlanes.xy !== '' &&
this.defaultPlanes.yz !== '' &&
this.defaultPlanes.xz !== ''
)
}
onPlaneSelectCallback = (id: string) => {} onPlaneSelectCallback = (id: string) => {}
onPlaneSelected(callback: (id: string) => void) { onPlaneSelected(callback: (id: string) => void) {