-
Notifications
You must be signed in to change notification settings - Fork 99
[SOLVE] Better integrate Sketch Block and Constraints in the Feature Tree #9712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[SOLVE] Better integrate Sketch Block and Constraints in the Feature Tree #9712
Conversation
…te all sketch icons from Figma Towards #9268
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // Sketch Solve Constraint case | ||
| const sketchBlock = getNodeFromPath<SketchBlock>( | ||
| astClone, | ||
| selection.codeRef.pathToNode, | ||
| wasmInstance, | ||
| 'SketchBlock' | ||
| ) | ||
| if (!err(sketchBlock) && sketchBlock.node.type === 'SketchBlock') { | ||
| const isItemInSketchBlock = | ||
| sketchBlock.deepPath.length > sketchBlock.shallowPath.length | ||
| const itemsIndex = -2 // index of items in body is second to last | ||
| const nodeIndex = sketchBlock.deepPath.at(itemsIndex)?.[0] | ||
| if ( | ||
| isItemInSketchBlock && | ||
| typeof nodeIndex === 'number' && | ||
| sketchBlock.node.body.items[nodeIndex] !== undefined | ||
| ) { | ||
| sketchBlock.node.body.items.splice(nodeIndex, 1) | ||
| return astClone | ||
| } | ||
|
|
||
| // Whole sketch block deletion case | ||
| if ( | ||
| typeof nodeIndex === 'number' && | ||
| astClone.body[nodeIndex] !== undefined | ||
| ) { | ||
| astClone.body.splice(nodeIndex, 1) | ||
| return astClone | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more case 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We surely can move this new deletion case to Rust, but I feel like this is something we could do all at once once we move there?
Closes #9268 and #9269
In this PR: