Add modal typing back in, and clean up old constraints code (#865)

* Revert "Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813)"

This reverts commit 9822576077.

* tsc

* refactor all buttons

* add parallel constraint

* typegen?

* add constraint removal constraint

* add perpendicular distance constraint

* state diagram layout

* fmt

* improve modal typing for setAngleLength
This commit is contained in:
Kurt Hutten
2023-10-16 08:54:38 +11:00
committed by GitHub
parent c6af62797d
commit b257b202c3
17 changed files with 602 additions and 1056 deletions

View File

@ -41,6 +41,7 @@ import {
setCodeMirrorCursor,
useStore,
} from 'useStore'
import { applyConstraintIntersect } from './Toolbar/Intersect'
type MachineContext<T extends AnyStateMachine> = {
state: StateFrom<T>
@ -372,6 +373,22 @@ export const ModelingMachineProvider = ({
),
}
},
'Get perpendicular distance info': async ({
selectionRanges,
}): Promise<SetSelections> => {
const { modifiedAst, pathToNodeMap } = await applyConstraintIntersect({
selectionRanges,
})
await kclManager.updateAst(modifiedAst, true)
return {
selectionType: 'completeSelection',
selection: pathMapToSelections(
kclManager.ast,
selectionRanges,
pathToNodeMap
),
}
},
},
devTools: true,
})