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,
|
addCallExpressionsToPipe,
|
||||||
addCloseToPipe,
|
addCloseToPipe,
|
||||||
addNewSketchLn,
|
addNewSketchLn,
|
||||||
|
ARG_END_ABSOLUTE,
|
||||||
changeSketchArguments,
|
changeSketchArguments,
|
||||||
updateStartProfileAtArgs,
|
updateStartProfileAtArgs,
|
||||||
} from 'lang/std/sketch'
|
} from 'lang/std/sketch'
|
||||||
@ -904,7 +905,7 @@ export class SceneEntities {
|
|||||||
createPipeSubstitution(),
|
createPipeSubstitution(),
|
||||||
])
|
])
|
||||||
: createCallExpressionStdLibKw('line', null, [
|
: createCallExpressionStdLibKw('line', null, [
|
||||||
createLabeledArg('endAbsolute', originCoords),
|
createLabeledArg(ARG_END_ABSOLUTE, originCoords),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
@ -629,8 +629,8 @@ export const lineTo: SketchLineHelperKw = {
|
|||||||
const { node: callExpression } = nodeMeta
|
const { node: callExpression } = nodeMeta
|
||||||
|
|
||||||
const toArrExp = createArrayExpression([
|
const toArrExp = createArrayExpression([
|
||||||
createLiteral(roundOff(to[0] - from[0], 2)),
|
createLiteral(roundOff(to[0], 2)),
|
||||||
createLiteral(roundOff(to[1] - from[1], 2)),
|
createLiteral(roundOff(to[1], 2)),
|
||||||
])
|
])
|
||||||
|
|
||||||
mutateKwArg(ARG_END_ABSOLUTE, callExpression, toArrExp)
|
mutateKwArg(ARG_END_ABSOLUTE, callExpression, toArrExp)
|
||||||
@ -2348,7 +2348,7 @@ export function changeSketchArguments(
|
|||||||
if (fnName in sketchLineHelperMapKw) {
|
if (fnName in sketchLineHelperMapKw) {
|
||||||
const isAbsolute =
|
const isAbsolute =
|
||||||
callExpression.type === 'CallExpressionKw' &&
|
callExpression.type === 'CallExpressionKw' &&
|
||||||
findKwArg('endAbsolute', callExpression) !== undefined
|
findKwArg(ARG_END_ABSOLUTE, callExpression) !== undefined
|
||||||
const correctFnName = fnName === 'line' && isAbsolute ? 'lineTo' : fnName
|
const correctFnName = fnName === 'line' && isAbsolute ? 'lineTo' : fnName
|
||||||
const { updateArgs } = sketchLineHelperMapKw[correctFnName]
|
const { updateArgs } = sketchLineHelperMapKw[correctFnName]
|
||||||
if (!updateArgs) {
|
if (!updateArgs) {
|
||||||
@ -2391,7 +2391,7 @@ export function getConstraintInfoKw(
|
|||||||
const fnName = callExpression?.callee?.name || ''
|
const fnName = callExpression?.callee?.name || ''
|
||||||
const isAbsolute =
|
const isAbsolute =
|
||||||
fnName === 'circleThreePoint' ||
|
fnName === 'circleThreePoint' ||
|
||||||
findKwArg('endAbsolute', callExpression) !== undefined
|
findKwArg(ARG_END_ABSOLUTE, callExpression) !== undefined
|
||||||
if (!(fnName in sketchLineHelperMapKw)) return []
|
if (!(fnName in sketchLineHelperMapKw)) return []
|
||||||
const correctFnName = fnName === 'line' && isAbsolute ? 'lineTo' : fnName
|
const correctFnName = fnName === 'line' && isAbsolute ? 'lineTo' : fnName
|
||||||
return sketchLineHelperMapKw[correctFnName].getConstraintInfo(
|
return sketchLineHelperMapKw[correctFnName].getConstraintInfo(
|
||||||
|
@ -138,7 +138,7 @@ function createCallWrapper(
|
|||||||
}
|
}
|
||||||
if (tooltip === 'lineTo') {
|
if (tooltip === 'lineTo') {
|
||||||
const labeledArgs = [
|
const labeledArgs = [
|
||||||
createLabeledArg('endAbsolute', createArrayExpression(val)),
|
createLabeledArg(ARG_END_ABSOLUTE, createArrayExpression(val)),
|
||||||
]
|
]
|
||||||
if (tag) {
|
if (tag) {
|
||||||
labeledArgs.push(createLabeledArg(ARG_TAG, tag))
|
labeledArgs.push(createLabeledArg(ARG_TAG, tag))
|
||||||
|
@ -24,6 +24,7 @@ import {
|
|||||||
isBinaryExpression,
|
isBinaryExpression,
|
||||||
isLiteralValueNumber,
|
isLiteralValueNumber,
|
||||||
} from 'lang/util'
|
} from 'lang/util'
|
||||||
|
import { ARG_END_ABSOLUTE } from 'lang/std/sketch'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It does not create the startSketchOn and it does not create the startProfileAt.
|
* It does not create the startSketchOn and it does not create the startProfileAt.
|
||||||
@ -70,7 +71,7 @@ export const getRectangleCallExpressions = (
|
|||||||
]),
|
]),
|
||||||
createCallExpressionStdLibKw('line', null, [
|
createCallExpressionStdLibKw('line', null, [
|
||||||
createLabeledArg(
|
createLabeledArg(
|
||||||
'endAbsolute',
|
ARG_END_ABSOLUTE,
|
||||||
createArrayExpression([
|
createArrayExpression([
|
||||||
createCallExpressionStdLib('profileStartX', [createPipeSubstitution()]),
|
createCallExpressionStdLib('profileStartX', [createPipeSubstitution()]),
|
||||||
createCallExpressionStdLib('profileStartY', [createPipeSubstitution()]),
|
createCallExpressionStdLib('profileStartY', [createPipeSubstitution()]),
|
||||||
|
Reference in New Issue
Block a user