Fix default memory so its always initialized in one place -> rust (#1395)
* initial redo Signed-off-by: Jess Frazelle <github@jessfraz.com> * default memory Signed-off-by: Jess Frazelle <github@jessfraz.com> * rename values * find tricky case * fix test Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
This commit is contained in:
@ -89,12 +89,16 @@ export async function applyConstraintAngleLength({
|
||||
isReferencingXAxis && angleOrLength === 'setAngle'
|
||||
|
||||
let forceVal = valueUsedInTransform || 0
|
||||
let calcIdentifier = createIdentifier('_0')
|
||||
let calcIdentifier = createIdentifier('ZERO')
|
||||
if (isReferencingYAxisAngle) {
|
||||
calcIdentifier = createIdentifier(forceVal < 0 ? '_270' : '_90')
|
||||
calcIdentifier = createIdentifier(
|
||||
forceVal < 0 ? 'THREE_QUARTER_TURN' : 'QUARTER_TURN'
|
||||
)
|
||||
forceVal = normaliseAngle(forceVal + (forceVal < 0 ? 90 : -90))
|
||||
} else if (isReferencingXAxisAngle) {
|
||||
calcIdentifier = createIdentifier(Math.abs(forceVal) > 90 ? '_180' : '_0')
|
||||
calcIdentifier = createIdentifier(
|
||||
Math.abs(forceVal) > 90 ? 'HALF_TURN' : 'ZERO'
|
||||
)
|
||||
forceVal =
|
||||
Math.abs(forceVal) > 90 ? normaliseAngle(forceVal - 180) : forceVal
|
||||
}
|
||||
@ -112,7 +116,7 @@ export async function applyConstraintAngleLength({
|
||||
)
|
||||
if (
|
||||
isReferencingYAxisAngle ||
|
||||
(isReferencingXAxisAngle && calcIdentifier.name !== '_0')
|
||||
(isReferencingXAxisAngle && calcIdentifier.name !== 'ZERO')
|
||||
) {
|
||||
finalValue = createBinaryExpressionWithUnary([calcIdentifier, finalValue])
|
||||
}
|
||||
|
Reference in New Issue
Block a user