Rejig state diagram for equipping tools (#2917)

* switch between line and rectangle tool

* disable line tool if rectangle has started

* make rectangle logic clearer from the diagram
This commit is contained in:
Kurt Hutten
2024-07-05 13:40:16 +10:00
committed by GitHub
parent fbc2e9d02c
commit 4f4167b247
6 changed files with 189 additions and 105 deletions

View File

@ -441,17 +441,6 @@ export const ModelingMachineProvider = ({
if (selectionRanges.codeBasedSelections.length <= 0) return false
return true
},
'Sketch is empty': ({ sketchDetails }) => {
const node = getNodeFromPath<VariableDeclaration>(
kclManager.ast,
sketchDetails?.sketchPathToNode || [],
'VariableDeclaration'
)
// This should not be returning false, and it should be caught
// but we need to simulate old behavior to move on.
if (err(node)) return false
return node.node?.declarations?.[0]?.init.type !== 'PipeExpression'
},
'Selection is on face': ({ selectionRanges }, { data }) => {
if (data?.forceNewSketch) return false
if (!isSingleCursorInPipe(selectionRanges, kclManager.ast))