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:
@ -481,15 +481,17 @@ export function createBinaryExpression([left, operator, right]: [
|
||||
|
||||
export function giveSketchFnCallTag(
|
||||
ast: Program,
|
||||
range: Range
|
||||
): { modifiedAst: Program; tag: string } {
|
||||
range: Range,
|
||||
tag?: string
|
||||
): { modifiedAst: Program; tag: string; isTagExisting: boolean } {
|
||||
const { node: primaryCallExp } = getNodeFromPath<CallExpression>(
|
||||
ast,
|
||||
getNodePathFromSourceRange(ast, range)
|
||||
)
|
||||
const firstArg = getFirstArg(primaryCallExp)
|
||||
const isTagExisting = !!firstArg.tag
|
||||
const tagValue = (firstArg.tag ||
|
||||
createLiteral(findUniqueName(ast, 'seg', 2))) as Literal
|
||||
createLiteral(tag || findUniqueName(ast, 'seg', 2))) as Literal
|
||||
const tagStr = String(tagValue.value)
|
||||
const newFirstArg = createFirstArg(
|
||||
primaryCallExp.callee.name as TooTip,
|
||||
@ -500,5 +502,6 @@ export function giveSketchFnCallTag(
|
||||
return {
|
||||
modifiedAst: ast,
|
||||
tag: tagStr,
|
||||
isTagExisting,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user