fix horz vert distance contraint (#2572)
fix hor vert distance contraint
This commit is contained in:
@ -106,7 +106,11 @@ export async function applyConstraintHorzVertDistance({
|
||||
value: valueUsedInTransform,
|
||||
initialVariableName: constraint === 'setHorzDistance' ? 'xDis' : 'yDis',
|
||||
} as any)
|
||||
if (segName === tagInfo?.tag && Number(value) === valueUsedInTransform) {
|
||||
if (
|
||||
!variableName &&
|
||||
segName === tagInfo?.tag &&
|
||||
Number(value) === valueUsedInTransform
|
||||
) {
|
||||
return {
|
||||
modifiedAst,
|
||||
pathToNodeMap,
|
||||
@ -126,6 +130,7 @@ export async function applyConstraintHorzVertDistance({
|
||||
forceValueUsedInTransform: finalValue,
|
||||
})
|
||||
if (variableName) {
|
||||
console.log('variableName', variableName)
|
||||
const newBody = [..._modifiedAst.body]
|
||||
newBody.splice(
|
||||
newVariableInsertIndex,
|
||||
@ -133,6 +138,10 @@ export async function applyConstraintHorzVertDistance({
|
||||
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,
|
||||
|
Reference in New Issue
Block a user