mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-04 09:27:53 +08:00
Accept transforms list instead of matrix for transform view parameter.
Summary: In #7916 I moved transform matrix decomposition logic from JS to java. The next step is to accept list of transforms instead oftransform matrix as a transform ReactProp. This way there is no extra processing required on JS side for the transform param (at least for android now) and this on the other hand allow us to execute transform updates (through offloaded animation) solely on the UI thread. After this change there is a whole bunch of stuff from `Libraries/Utilities/MatrixMath.js` that can be deleted (methods like: determinant, inverse, transpose). Although astreet mentioned under one of my previous commits that the code is still being referenced internally at fb, so I decided not to delete it here. **Test plan (required)** Run UIExplorer Transform example before and after - compare the results Run android unit test: com.facebook.react.uimanager.MatrixMathHelperTest Closes https://github.com/facebook/react-native/pull/8892 Differential Revision: D3676017 Pulled By: astreet fbshipit-source-id: 5275e30805a85c12c89bea44e8b3a2b2ec7b33fa
This commit is contained in:
committed by
Facebook Github Bot
parent
eba6c379c3
commit
68b9a36858
@@ -114,21 +114,12 @@ public class MatrixMathHelperTest {
|
||||
verifyXRotatedMatrix(360, 0d, 0d, 0d);
|
||||
}
|
||||
|
||||
private static double[] createIdentityMatrix() {
|
||||
return new double[] {
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1
|
||||
};
|
||||
}
|
||||
|
||||
private static double degreesToRadians(double degrees) {
|
||||
return degrees * Math.PI / 180;
|
||||
}
|
||||
|
||||
private static double[] createRotateZ(double radians) {
|
||||
double[] mat = createIdentityMatrix();
|
||||
double[] mat = MatrixMathHelper.createIdentityMatrix();
|
||||
mat[0] = Math.cos(radians);
|
||||
mat[1] = Math.sin(radians);
|
||||
mat[4] = -Math.sin(radians);
|
||||
@@ -137,7 +128,7 @@ public class MatrixMathHelperTest {
|
||||
}
|
||||
|
||||
private static double[] createRotateY(double radians) {
|
||||
double[] mat = createIdentityMatrix();
|
||||
double[] mat = MatrixMathHelper.createIdentityMatrix();
|
||||
mat[0] = Math.cos(radians);
|
||||
mat[2] = -Math.sin(radians);
|
||||
mat[8] = Math.sin(radians);
|
||||
@@ -146,7 +137,7 @@ public class MatrixMathHelperTest {
|
||||
}
|
||||
|
||||
private static double[] createRotateX(double radians) {
|
||||
double[] mat = createIdentityMatrix();
|
||||
double[] mat = MatrixMathHelper.createIdentityMatrix();
|
||||
mat[5] = Math.cos(radians);
|
||||
mat[6] = Math.sin(radians);
|
||||
mat[9] = -Math.sin(radians);
|
||||
|
||||
Reference in New Issue
Block a user