Horz/Vert distance constraint with modal workflow (#43)

* button style tweak

* Remove duplication constraint ast transforms

* giveSketchFnCallTag to return if line already had a tag

* remove duplication

* update tag name to referenceSegName

* Update transform shape to return key details about the transform

* add modal to hor vert distance workflow

* fix browser env stuff from breaking tests

* fmt
This commit is contained in:
Kurt Hutten
2023-03-07 15:45:59 +11:00
committed by GitHub
parent a0518c556f
commit 2ac24bcd95
16 changed files with 376 additions and 203 deletions

View File

@ -3,8 +3,8 @@ import { lexer } from '../tokeniser'
import {
getConstraintType,
getTransformInfos,
transformAstForSketchLines,
transformAstForHorzVert,
transformAstSketchLines,
transformSecondarySketchLinesTagFirst,
ConstraintType,
} from './sketchcombos'
import { initPromise } from '../rust'
@ -204,7 +204,7 @@ show(part001)`
'equalLength'
)
const newAst = transformAstForSketchLines({
const newAst = transformSecondarySketchLinesTagFirst({
ast,
selectionRanges,
transformInfos,
@ -282,11 +282,12 @@ show(part001)`
const programMemory = executor(ast)
const transformInfos = getTransformInfos(selectionRanges, ast, 'horizontal')
const newAst = transformAstForHorzVert({
const newAst = transformAstSketchLines({
ast,
selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
})?.modifiedAst
const newCode = recast(newAst)
expect(newCode).toBe(expectModifiedScript)
@ -331,11 +332,12 @@ show(part001)`
const programMemory = executor(ast)
const transformInfos = getTransformInfos(selectionRanges, ast, 'vertical')
const newAst = transformAstForHorzVert({
const newAst = transformAstSketchLines({
ast,
selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
})?.modifiedAst
const newCode = recast(newAst)
expect(newCode).toBe(expectModifiedScript)
@ -419,7 +421,7 @@ function helperThing(
constraint
)
const newAst = transformAstForSketchLines({
const newAst = transformSecondarySketchLinesTagFirst({
ast,
selectionRanges,
transformInfos,