diff --git a/e2e/playwright/snapshots/prompt-to-edit/prompt-to-edit-snapshot-tests-spec-ts--change-colour.snap.json b/e2e/playwright/snapshots/prompt-to-edit/prompt-to-edit-snapshot-tests-spec-ts--change-colour.snap.json index 8eb0256d3..c37a4a817 100644 --- a/e2e/playwright/snapshots/prompt-to-edit/prompt-to-edit-snapshot-tests-spec-ts--change-colour.snap.json +++ b/e2e/playwright/snapshots/prompt-to-edit/prompt-to-edit-snapshot-tests-spec-ts--change-colour.snap.json @@ -29,5 +29,5 @@ } } ], - "kcl_version": "0.2.41" + "kcl_version": "0.2.44" } \ No newline at end of file diff --git a/src/clientSideScene/sceneEntities.ts b/src/clientSideScene/sceneEntities.ts index 94bd0b966..effb9d123 100644 --- a/src/clientSideScene/sceneEntities.ts +++ b/src/clientSideScene/sceneEntities.ts @@ -72,6 +72,7 @@ import { addCallExpressionsToPipe, addCloseToPipe, addNewSketchLn, + ARG_END_ABSOLUTE, changeSketchArguments, updateStartProfileAtArgs, } from 'lang/std/sketch' @@ -904,7 +905,7 @@ export class SceneEntities { createPipeSubstitution(), ]) : createCallExpressionStdLibKw('line', null, [ - createLabeledArg('endAbsolute', originCoords), + createLabeledArg(ARG_END_ABSOLUTE, originCoords), ]), ], }) diff --git a/src/lang/std/sketch.ts b/src/lang/std/sketch.ts index 84fb41a39..3a4227ef3 100644 --- a/src/lang/std/sketch.ts +++ b/src/lang/std/sketch.ts @@ -629,8 +629,8 @@ export const lineTo: SketchLineHelperKw = { const { node: callExpression } = nodeMeta const toArrExp = createArrayExpression([ - createLiteral(roundOff(to[0] - from[0], 2)), - createLiteral(roundOff(to[1] - from[1], 2)), + createLiteral(roundOff(to[0], 2)), + createLiteral(roundOff(to[1], 2)), ]) mutateKwArg(ARG_END_ABSOLUTE, callExpression, toArrExp) @@ -2348,7 +2348,7 @@ export function changeSketchArguments( if (fnName in sketchLineHelperMapKw) { const isAbsolute = callExpression.type === 'CallExpressionKw' && - findKwArg('endAbsolute', callExpression) !== undefined + findKwArg(ARG_END_ABSOLUTE, callExpression) !== undefined const correctFnName = fnName === 'line' && isAbsolute ? 'lineTo' : fnName const { updateArgs } = sketchLineHelperMapKw[correctFnName] if (!updateArgs) { @@ -2391,7 +2391,7 @@ export function getConstraintInfoKw( const fnName = callExpression?.callee?.name || '' const isAbsolute = fnName === 'circleThreePoint' || - findKwArg('endAbsolute', callExpression) !== undefined + findKwArg(ARG_END_ABSOLUTE, callExpression) !== undefined if (!(fnName in sketchLineHelperMapKw)) return [] const correctFnName = fnName === 'line' && isAbsolute ? 'lineTo' : fnName return sketchLineHelperMapKw[correctFnName].getConstraintInfo( diff --git a/src/lang/std/sketchcombos.ts b/src/lang/std/sketchcombos.ts index a419fa917..a8781c0f3 100644 --- a/src/lang/std/sketchcombos.ts +++ b/src/lang/std/sketchcombos.ts @@ -138,7 +138,7 @@ function createCallWrapper( } if (tooltip === 'lineTo') { const labeledArgs = [ - createLabeledArg('endAbsolute', createArrayExpression(val)), + createLabeledArg(ARG_END_ABSOLUTE, createArrayExpression(val)), ] if (tag) { labeledArgs.push(createLabeledArg(ARG_TAG, tag)) diff --git a/src/lib/rectangleTool.ts b/src/lib/rectangleTool.ts index a27253563..7b2fa3303 100644 --- a/src/lib/rectangleTool.ts +++ b/src/lib/rectangleTool.ts @@ -24,6 +24,7 @@ import { isBinaryExpression, isLiteralValueNumber, } from 'lang/util' +import { ARG_END_ABSOLUTE } from 'lang/std/sketch' /** * It does not create the startSketchOn and it does not create the startProfileAt. @@ -70,7 +71,7 @@ export const getRectangleCallExpressions = ( ]), createCallExpressionStdLibKw('line', null, [ createLabeledArg( - 'endAbsolute', + ARG_END_ABSOLUTE, createArrayExpression([ createCallExpressionStdLib('profileStartX', [createPipeSubstitution()]), createCallExpressionStdLib('profileStartY', [createPipeSubstitution()]),