Compare commits

...

2 Commits

Author SHA1 Message Date
32068983a0 Merge branch 'main' into jtran/fix-constraints 2024-07-10 15:39:44 -04:00
e63134e9fb Fix constraints to be enabled after dragging sketch
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2024-07-05 17:41:22 -04:00
2 changed files with 15 additions and 0 deletions

View File

@ -857,6 +857,11 @@ export class SceneEntities {
let addingNewSegmentStatus: 'nothing' | 'pending' | 'added' = 'nothing'
sceneInfra.setCallbacks({
onDragEnd: async () => {
// After the user drags, code has been updated, and source ranges are
// potentially stale.
const astResult = kclManager.updateSourceRanges()
if (trap(astResult)) return
if (addingNewSegmentStatus !== 'nothing') {
await this.tearDownSketch({ removeAxis: false })
this.setupSketch({

View File

@ -154,6 +154,16 @@ export class KclManager {
this._executeCallback = callback
}
updateSourceRanges(): Error | null {
const newAst = parse(recast(this.ast))
if (err(newAst)) {
return newAst
}
this.ast = newAst
return null
}
clearAst() {
this._ast = {
body: [],