Bugfix: absolute line segment dragging behavior offset was relative (#5571)
* Refactor: Use the named constant for 'endAbsolute' in more places * Bugfix: lineTo was calculating relative distances instead of absolute * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -29,5 +29,5 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"kcl_version": "0.2.41"
|
||||
"kcl_version": "0.2.44"
|
||||
}
|
@ -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),
|
||||
]),
|
||||
],
|
||||
})
|
||||
|
@ -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(
|
||||
|
@ -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))
|
||||
|
@ -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()]),
|
||||
|
Reference in New Issue
Block a user