fix single selection angle constraint (#2555)

* fix single selection angle constraint

* fix angle for multi selections

* make test more robust for makos
This commit is contained in:
Kurt Hutten
2024-05-31 11:36:08 +10:00
committed by GitHub
parent 8c3af1a72a
commit bd16902f02
10 changed files with 262 additions and 11 deletions

View File

@ -98,7 +98,11 @@ export async function applyConstraintAngleBetween({
value: valueUsedInTransform,
initialVariableName: 'angle',
} as any)
if (segName === tagInfo?.tag && Number(value) === valueUsedInTransform) {
if (
segName === tagInfo?.tag &&
Number(value) === valueUsedInTransform &&
!variableName
) {
return {
modifiedAst,
pathToNodeMap,
@ -128,6 +132,10 @@ export async function applyConstraintAngleBetween({
createVariableDeclaration(variableName, valueNode)
)
_modifiedAst.body = newBody
Object.values(_pathToNodeMap).forEach((pathToNode) => {
const index = pathToNode.findIndex((a) => a[0] === 'body') + 1
pathToNode[index][0] = Number(pathToNode[index][0]) + 1
})
}
return {
modifiedAst: _modifiedAst,