Cursors should stay after a code-mod (#113)

* setup to get path to nodes back from ast-mods

* fix cursor setting for constraint buttons that use transformSecondarySketchLinesTagFirst

* fix cursors for constraints that use transformAstSketchLines
This commit is contained in:
Kurt Hutten
2023-04-14 07:49:36 +10:00
committed by GitHub
parent 2fc68e7c82
commit 15699361a0
17 changed files with 410 additions and 312 deletions

View File

@ -11,17 +11,18 @@ import {
transformSecondarySketchLinesTagFirst,
getTransformInfos,
} from '../../lang/std/sketchcombos'
import { updateCursors } from '../../lang/util'
export const EqualAngle = () => {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
(s) => ({
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
})
)
setCursor: s.setCursor,
}))
const [enableEqual, setEnableEqual] = useState(false)
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
useEffect(() => {
@ -72,18 +73,19 @@ export const EqualAngle = () => {
return (
<button
onClick={() =>
transformInfos &&
ast &&
updateAst(
onClick={async () => {
if (!(transformInfos && ast)) return
const { modifiedAst, pathToNodeMap } =
transformSecondarySketchLinesTagFirst({
ast,
selectionRanges,
transformInfos,
programMemory,
})?.modifiedAst
)
}
})
updateAst(modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
}}
className={`border m-1 px-1 rounded text-xs ${
enableEqual ? 'bg-gray-50 text-gray-800' : 'bg-gray-200 text-gray-400'
}`}

View File

@ -11,17 +11,18 @@ import {
transformSecondarySketchLinesTagFirst,
getTransformInfos,
} from '../../lang/std/sketchcombos'
import { updateCursors } from '../../lang/util'
export const EqualLength = () => {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
(s) => ({
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
})
)
setCursor: s.setCursor,
}))
const [enableEqual, setEnableEqual] = useState(false)
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
useEffect(() => {
@ -72,18 +73,19 @@ export const EqualLength = () => {
return (
<button
onClick={() =>
transformInfos &&
ast &&
updateAst(
onClick={() => {
if (!(transformInfos && ast)) return
const { modifiedAst, pathToNodeMap } =
transformSecondarySketchLinesTagFirst({
ast,
selectionRanges,
transformInfos,
programMemory,
})?.modifiedAst
)
}
})
updateAst(modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
}}
className={`border m-1 px-1 rounded text-xs ${
enableEqual ? 'bg-gray-50 text-gray-800' : 'bg-gray-200 text-gray-400'
}`}

View File

@ -10,21 +10,22 @@ import {
getTransformInfos,
transformAstSketchLines,
} from '../../lang/std/sketchcombos'
import { updateCursors } from '../../lang/util'
export const HorzVert = ({
horOrVert,
}: {
horOrVert: 'vertical' | 'horizontal'
}) => {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
(s) => ({
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
})
)
setCursor: s.setCursor,
}))
const [enableHorz, setEnableHorz] = useState(false)
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
useEffect(() => {
@ -51,19 +52,19 @@ export const HorzVert = ({
return (
<button
onClick={() =>
transformInfos &&
ast &&
updateAst(
transformAstSketchLines({
ast,
selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
})?.modifiedAst
)
}
onClick={() => {
if (!transformInfos || !ast) return
const { modifiedAst, pathToNodeMap } = transformAstSketchLines({
ast,
selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
})
updateAst(modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
}}
className={`border m-1 px-1 rounded text-xs ${
enableHorz ? 'bg-gray-50 text-gray-800' : 'bg-gray-200 text-gray-400'
}`}

View File

@ -20,19 +20,20 @@ import {
import { GetInfoModal } from '../SetHorVertDistanceModal'
import { createVariableDeclaration } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { updateCursors } from '../../lang/util'
const getModalInfo = create(GetInfoModal as any)
export const Intersect = () => {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
(s) => ({
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
})
)
setCursor: s.setCursor,
}))
const [enable, setEnable] = useState(false)
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
const [forecdSelectionRanges, setForcedSelectionRanges] =
@ -125,63 +126,66 @@ export const Intersect = () => {
return (
<button
onClick={async () => {
if (transformInfos && ast && forecdSelectionRanges) {
const { modifiedAst, tagInfo, valueUsedInTransform } =
if (!(transformInfos && ast && forecdSelectionRanges)) return
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } =
transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(ast)),
selectionRanges: forecdSelectionRanges,
transformInfos,
programMemory,
})
const {
segName,
value,
valueNode,
variableName,
newVariableInsertIndex,
sign,
}: {
segName: string
value: number
valueNode: Value
variableName?: string
newVariableInsertIndex: number
sign: number
} = await getModalInfo({
segName: tagInfo?.tag,
isSegNameEditable: !tagInfo?.isTagExisting,
value: valueUsedInTransform,
initialVariableName: 'offset',
} as any)
if (segName === tagInfo?.tag && value === valueUsedInTransform) {
updateAst(modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
} else {
// transform again but forcing certain values
const finalValue = removeDoubleNegatives(
valueNode as BinaryPart,
sign,
variableName
)
const { modifiedAst: _modifiedAst, pathToNodeMap } =
transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(ast)),
ast,
selectionRanges: forecdSelectionRanges,
transformInfos,
programMemory,
forceSegName: segName,
forceValueUsedInTransform: finalValue,
})
const {
segName,
value,
valueNode,
variableName,
newVariableInsertIndex,
sign,
}: {
segName: string
value: number
valueNode: Value
variableName?: string
newVariableInsertIndex: number
sign: number
} = await getModalInfo({
segName: tagInfo?.tag,
isSegNameEditable: !tagInfo?.isTagExisting,
value: valueUsedInTransform,
initialVariableName: 'offset',
} as any)
if (segName === tagInfo?.tag && value === valueUsedInTransform) {
updateAst(modifiedAst)
} else {
// transform again but forcing certain values
const finalValue = removeDoubleNegatives(
valueNode as BinaryPart,
sign,
variableName
if (variableName) {
const newBody = [..._modifiedAst.body]
newBody.splice(
newVariableInsertIndex,
0,
createVariableDeclaration(variableName, valueNode)
)
const { modifiedAst: _modifiedAst } =
transformSecondarySketchLinesTagFirst({
ast,
selectionRanges: forecdSelectionRanges,
transformInfos,
programMemory,
forceSegName: segName,
forceValueUsedInTransform: finalValue,
})
if (variableName) {
const newBody = [..._modifiedAst.body]
newBody.splice(
newVariableInsertIndex,
0,
createVariableDeclaration(variableName, valueNode)
)
_modifiedAst.body = newBody
}
updateAst(_modifiedAst)
_modifiedAst.body = newBody
}
updateAst(_modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
}
}}
className={`border m-1 px-1 rounded text-xs ${

View File

@ -10,17 +10,18 @@ import {
getRemoveConstraintsTransforms,
transformAstSketchLines,
} from '../../lang/std/sketchcombos'
import { updateCursors } from '../../lang/util'
export const RemoveConstrainingValues = () => {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
(s) => ({
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
})
)
setCursor: s.setCursor,
}))
const [enableHorz, setEnableHorz] = useState(false)
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
useEffect(() => {
@ -55,19 +56,19 @@ export const RemoveConstrainingValues = () => {
return (
<button
onClick={() =>
transformInfos &&
ast &&
updateAst(
transformAstSketchLines({
ast,
selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
})?.modifiedAst
)
}
onClick={() => {
if (!transformInfos || !ast) return
const { modifiedAst, pathToNodeMap } = transformAstSketchLines({
ast,
selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
})
updateAst(modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
}}
className={`border m-1 px-1 rounded text-xs ${
enableHorz ? 'bg-gray-50 text-gray-800' : 'bg-gray-200 text-gray-400'
}`}

View File

@ -18,6 +18,7 @@ import {
createVariableDeclaration,
} from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { updateCursors } from '../../lang/util'
const getModalInfo = create(SetAngleLengthModal as any)
@ -26,19 +27,15 @@ export const SetAbsDistance = ({
}: {
buttonType: 'xAbs' | 'yAbs' | 'snapToYAxis' | 'snapToXAxis'
}) => {
const {
guiMode,
selectionRanges: selections,
ast,
programMemory,
updateAst,
} = useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
}))
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
setCursor: s.setCursor,
}))
const disType: ConstraintType =
buttonType === 'xAbs' || buttonType === 'yAbs'
? buttonType
@ -49,7 +46,7 @@ export const SetAbsDistance = ({
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
useEffect(() => {
if (!ast) return
const paths = selections.codeBasedSelections.map(({ range }) =>
const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(ast, range)
)
const nodes = paths.map(
@ -62,25 +59,25 @@ export const SetAbsDistance = ({
toolTips.includes(node.callee.name as any)
)
const theTransforms = getTransformInfos(selections, ast, disType)
const theTransforms = getTransformInfos(selectionRanges, ast, disType)
setTransformInfos(theTransforms)
const enableY =
disType === 'yAbs' &&
selections.otherSelections.length === 1 &&
selections.otherSelections[0] === 'x-axis' // select the x axis to set the distance from it i.e. y
selectionRanges.otherSelections.length === 1 &&
selectionRanges.otherSelections[0] === 'x-axis' // select the x axis to set the distance from it i.e. y
const enableX =
disType === 'xAbs' &&
selections.otherSelections.length === 1 &&
selections.otherSelections[0] === 'y-axis' // select the y axis to set the distance from it i.e. x
selectionRanges.otherSelections.length === 1 &&
selectionRanges.otherSelections[0] === 'y-axis' // select the y axis to set the distance from it i.e. x
const _enableHorz =
isAllTooltips &&
theTransforms.every(Boolean) &&
selections.codeBasedSelections.length === 1 &&
selectionRanges.codeBasedSelections.length === 1 &&
(enableX || enableY)
setEnableAngLen(_enableHorz)
}, [guiMode, selections])
}, [guiMode, selectionRanges])
if (guiMode.mode !== 'sketch') return null
const isAlign = buttonType === 'snapToYAxis' || buttonType === 'snapToXAxis'
@ -91,7 +88,7 @@ export const SetAbsDistance = ({
if (!(transformInfos && ast)) return
const { valueUsedInTransform } = transformAstSketchLines({
ast: JSON.parse(JSON.stringify(ast)),
selectionRanges: selections,
selectionRanges: selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
@ -108,14 +105,15 @@ export const SetAbsDistance = ({
? createIdentifier('_0')
: removeDoubleNegatives(valueNode, sign, variableName)
const { modifiedAst: _modifiedAst } = transformAstSketchLines({
ast: JSON.parse(JSON.stringify(ast)),
selectionRanges: selections,
transformInfos,
programMemory,
referenceSegName: '',
forceValueUsedInTransform: finalValue,
})
const { modifiedAst: _modifiedAst, pathToNodeMap } =
transformAstSketchLines({
ast: JSON.parse(JSON.stringify(ast)),
selectionRanges: selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
forceValueUsedInTransform: finalValue,
})
if (variableName) {
const newBody = [..._modifiedAst.body]
newBody.splice(
@ -126,7 +124,9 @@ export const SetAbsDistance = ({
_modifiedAst.body = newBody
}
updateAst(_modifiedAst)
updateAst(_modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
} catch (e) {
console.log('e', e)
}

View File

@ -19,19 +19,20 @@ import {
import { GetInfoModal } from '../SetHorVertDistanceModal'
import { createVariableDeclaration } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { updateCursors } from '../../lang/util'
const getModalInfo = create(GetInfoModal as any)
export const SetAngleBetween = () => {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
(s) => ({
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
})
)
setCursor: s.setCursor,
}))
const [enable, setEnable] = useState(false)
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
useEffect(() => {
@ -83,63 +84,66 @@ export const SetAngleBetween = () => {
return (
<button
onClick={async () => {
if (transformInfos && ast) {
const { modifiedAst, tagInfo, valueUsedInTransform } =
if (!(transformInfos && ast)) return
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } =
transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(ast)),
selectionRanges,
transformInfos,
programMemory,
})
const {
segName,
value,
valueNode,
variableName,
newVariableInsertIndex,
sign,
}: {
segName: string
value: number
valueNode: Value
variableName?: string
newVariableInsertIndex: number
sign: number
} = await getModalInfo({
segName: tagInfo?.tag,
isSegNameEditable: !tagInfo?.isTagExisting,
value: valueUsedInTransform,
initialVariableName: 'angle',
} as any)
if (segName === tagInfo?.tag && value === valueUsedInTransform) {
updateAst(modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
} else {
const finalValue = removeDoubleNegatives(
valueNode as BinaryPart,
sign,
variableName
)
// transform again but forcing certain values
const { modifiedAst: _modifiedAst, pathToNodeMap } =
transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(ast)),
ast,
selectionRanges,
transformInfos,
programMemory,
forceSegName: segName,
forceValueUsedInTransform: finalValue,
})
const {
segName,
value,
valueNode,
variableName,
newVariableInsertIndex,
sign,
}: {
segName: string
value: number
valueNode: Value
variableName?: string
newVariableInsertIndex: number
sign: number
} = await getModalInfo({
segName: tagInfo?.tag,
isSegNameEditable: !tagInfo?.isTagExisting,
value: valueUsedInTransform,
initialVariableName: 'angle',
} as any)
if (segName === tagInfo?.tag && value === valueUsedInTransform) {
updateAst(modifiedAst)
} else {
const finalValue = removeDoubleNegatives(
valueNode as BinaryPart,
sign,
variableName
if (variableName) {
const newBody = [..._modifiedAst.body]
newBody.splice(
newVariableInsertIndex,
0,
createVariableDeclaration(variableName, valueNode)
)
// transform again but forcing certain values
const { modifiedAst: _modifiedAst } =
transformSecondarySketchLinesTagFirst({
ast,
selectionRanges,
transformInfos,
programMemory,
forceSegName: segName,
forceValueUsedInTransform: finalValue,
})
if (variableName) {
const newBody = [..._modifiedAst.body]
newBody.splice(
newVariableInsertIndex,
0,
createVariableDeclaration(variableName, valueNode)
)
_modifiedAst.body = newBody
}
updateAst(_modifiedAst)
_modifiedAst.body = newBody
}
updateAst(_modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
}
}}
className={`border m-1 px-1 rounded text-xs ${

View File

@ -20,6 +20,7 @@ import {
import { GetInfoModal } from '../SetHorVertDistanceModal'
import { createLiteral, createVariableDeclaration } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { updateCursors } from '../../lang/util'
const getModalInfo = create(GetInfoModal as any)
@ -32,15 +33,15 @@ export const SetHorzVertDistance = ({
| 'alignEndsHorizontally'
| 'alignEndsVertically'
}) => {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
(s) => ({
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
})
)
setCursor: s.setCursor,
}))
const constraint: ConstraintType =
buttonType === 'setHorzDistance' || buttonType === 'setVertDistance'
? buttonType
@ -105,67 +106,66 @@ export const SetHorzVertDistance = ({
return (
<button
onClick={async () => {
if (transformInfos && ast) {
const { modifiedAst, tagInfo, valueUsedInTransform } =
if (!(transformInfos && ast)) return
const { modifiedAst, tagInfo, valueUsedInTransform, pathToNodeMap } =
transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(ast)),
selectionRanges,
transformInfos,
programMemory,
})
const {
segName,
value,
valueNode,
variableName,
newVariableInsertIndex,
sign,
}: {
segName: string
value: number
valueNode: Value
variableName?: string
newVariableInsertIndex: number
sign: number
} = await (!isAlign &&
getModalInfo({
segName: tagInfo?.tag,
isSegNameEditable: !tagInfo?.isTagExisting,
value: valueUsedInTransform,
initialVariableName:
constraint === 'setHorzDistance' ? 'xDis' : 'yDis',
} as any))
if (segName === tagInfo?.tag && value === valueUsedInTransform) {
updateAst(modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
} else {
let finalValue = isAlign
? createLiteral(0)
: removeDoubleNegatives(valueNode as BinaryPart, sign, variableName)
// transform again but forcing certain values
const { modifiedAst: _modifiedAst, pathToNodeMap } =
transformSecondarySketchLinesTagFirst({
ast: JSON.parse(JSON.stringify(ast)),
ast,
selectionRanges,
transformInfos,
programMemory,
forceSegName: segName,
forceValueUsedInTransform: finalValue,
})
const {
segName,
value,
valueNode,
variableName,
newVariableInsertIndex,
sign,
}: {
segName: string
value: number
valueNode: Value
variableName?: string
newVariableInsertIndex: number
sign: number
} = await (!isAlign &&
getModalInfo({
segName: tagInfo?.tag,
isSegNameEditable: !tagInfo?.isTagExisting,
value: valueUsedInTransform,
initialVariableName:
constraint === 'setHorzDistance' ? 'xDis' : 'yDis',
} as any))
if (segName === tagInfo?.tag && value === valueUsedInTransform) {
updateAst(modifiedAst)
} else {
let finalValue = isAlign
? createLiteral(0)
: removeDoubleNegatives(
valueNode as BinaryPart,
sign,
variableName
)
// transform again but forcing certain values
const { modifiedAst: _modifiedAst } =
transformSecondarySketchLinesTagFirst({
ast,
selectionRanges,
transformInfos,
programMemory,
forceSegName: segName,
forceValueUsedInTransform: finalValue,
})
if (variableName) {
const newBody = [..._modifiedAst.body]
newBody.splice(
newVariableInsertIndex,
0,
createVariableDeclaration(variableName, valueNode)
)
_modifiedAst.body = newBody
}
updateAst(_modifiedAst)
if (variableName) {
const newBody = [..._modifiedAst.body]
newBody.splice(
newVariableInsertIndex,
0,
createVariableDeclaration(variableName, valueNode)
)
_modifiedAst.body = newBody
}
updateAst(_modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
}
}}
className={`border m-1 px-1 rounded text-xs ${

View File

@ -19,6 +19,7 @@ import {
} from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { normaliseAngle } from '../../lib/utils'
import { updateCursors } from '../../lang/util'
const getModalInfo = create(SetAngleLengthModal as any)
@ -27,15 +28,15 @@ export const SetAngleLength = ({
}: {
angleOrLength: 'setAngle' | 'setLength'
}) => {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
(s) => ({
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
ast: s.ast,
updateAst: s.updateAst,
selectionRanges: s.selectionRanges,
programMemory: s.programMemory,
})
)
setCursor: s.setCursor,
}))
const [enableAngLen, setEnableAngLen] = useState(false)
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
useEffect(() => {
@ -116,14 +117,15 @@ export const SetAngleLength = ({
])
}
const { modifiedAst: _modifiedAst } = transformAstSketchLines({
ast: JSON.parse(JSON.stringify(ast)),
selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
forceValueUsedInTransform: finalValue,
})
const { modifiedAst: _modifiedAst, pathToNodeMap } =
transformAstSketchLines({
ast: JSON.parse(JSON.stringify(ast)),
selectionRanges,
transformInfos,
programMemory,
referenceSegName: '',
forceValueUsedInTransform: finalValue,
})
if (variableName) {
const newBody = [..._modifiedAst.body]
newBody.splice(
@ -134,7 +136,9 @@ export const SetAngleLength = ({
_modifiedAst.body = newBody
}
updateAst(_modifiedAst)
updateAst(_modifiedAst, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})
} catch (e) {
console.log('e', e)
}