Skip to content

Commit 988d66d

Browse files
authored
Merge pull request #409 from acrilique/two-pointer-scale-uniform
fix #386
2 parents 1db1d9c + ba4420a commit 988d66d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

packages/handle/src/computations/two-pointer.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,23 @@ export function computeTwoPointerHandleTransformState(
119119
storeData.prevAngle = angle
120120
qHelper1.premultiply(quaterionHelper2.setFromAxisAngle(vectorHelper2, angle))
121121

122+
//compute the initial world quaternion and initial world scale
123+
matrixHelper3.compose(
124+
storeData.initialTargetPosition,
125+
storeData.initialTargetQuaternion,
126+
storeData.initialTargetScale,
127+
)
128+
if (storeData.initialTargetParentWorldMatrix != null) {
129+
matrixHelper3.premultiply(storeData.initialTargetParentWorldMatrix)
130+
}
131+
122132
//compute delta scale
123133
if (typeof options.scale === 'object' && (options.scale.uniform ?? false)) {
124134
scaleHelper.setScalar(deltaHelper2.length() / deltaHelper1.length())
125135
} else {
126-
//compute the initial world quaternion and initial world scale
127-
matrixHelper3.compose(
128-
storeData.initialTargetPosition,
129-
storeData.initialTargetQuaternion,
130-
storeData.initialTargetScale,
131-
)
132-
if (storeData.initialTargetParentWorldMatrix != null) {
133-
matrixHelper3.premultiply(storeData.initialTargetParentWorldMatrix)
134-
}
136+
//decompose the initial target world matrix
135137
matrixHelper3.decompose(vectorHelper3, quaterionHelper2, vectorHelper4)
138+
136139
//compute the initial scale axis
137140
vectorHelper1.copy(deltaHelper1).applyQuaternion(quaterionHelper2.invert()).divide(vectorHelper4)
138141
vectorHelper1.x = Math.abs(vectorHelper1.x)

0 commit comments

Comments
 (0)