fix ABS XY constraint (#2560)

* fix source rangen for abs x y constraints

* fix abs bug

* add e2e test
This commit is contained in:
Kurt Hutten
2024-05-31 14:00:32 +10:00
committed by GitHub
parent bd16902f02
commit 3c01924184
4 changed files with 157 additions and 25 deletions

View File

@ -120,6 +120,10 @@ export async function applyConstraintAbsDistance({
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, pathToNodeMap }
}