Permalink
Browse files

Add rotateX and rotateY transforms to Android Views .

Summary:
Setting rotateX and rotateY for Android Views.
Closes #4413

Reviewed By: svcscm

Differential Revision: D2741328

Pulled By: mkonicek

fb-gh-sync-id: 931027c006bc571ef374a7b82cc7074b8a34bc8d
  • Loading branch information...
Felipe Martim facebook-github-bot-8
Felipe Martim authored and facebook-github-bot-8 committed Dec 10, 2015
1 parent 64a78ed commit 96553cf553e26e48a87f83030e04aef788f2dfef
@@ -465,10 +465,10 @@ var MatrixMath = {
// Solve the equation by inverting perspectiveMatrix and multiplying
// rightHandSide by the inverse.
- var inversePerspectiveMatrix = MatrixMath.inverse3x3(
+ var inversePerspectiveMatrix = MatrixMath.inverse(
perspectiveMatrix
);
- var transposedInversePerspectiveMatrix = MatrixMath.transpose4x4(
+ var transposedInversePerspectiveMatrix = MatrixMath.transpose(
inversePerspectiveMatrix
);
var perspective = MatrixMath.multiplyVectorByMatrix(
@@ -583,6 +583,8 @@ var MatrixMath = {
translation,
rotate: rotationDegrees[2],
+ rotateX: rotationDegrees[0],
+ rotateY: rotationDegrees[1],
scaleX: scale[0],
scaleY: scale[1],
translateX: translation[0],
@@ -18,6 +18,8 @@
private static final String PROP_BACKGROUND_COLOR = ViewProps.BACKGROUND_COLOR;
private static final String PROP_DECOMPOSED_MATRIX = "decomposedMatrix";
private static final String PROP_DECOMPOSED_MATRIX_ROTATE = "rotate";
+ private static final String PROP_DECOMPOSED_MATRIX_ROTATE_X = "rotateX";
+ private static final String PROP_DECOMPOSED_MATRIX_ROTATE_Y = "rotateY";
private static final String PROP_DECOMPOSED_MATRIX_SCALE_X = "scaleX";
private static final String PROP_DECOMPOSED_MATRIX_SCALE_Y = "scaleY";
private static final String PROP_DECOMPOSED_MATRIX_TRANSLATE_X = "translateX";
@@ -144,6 +146,10 @@ private static void setTransformMatrix(View view, ReadableMap matrix) {
(float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_TRANSLATE_Y)));
view.setRotation(
(float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_ROTATE));
+ view.setRotationX(
+ (float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_ROTATE_X));
+ view.setRotationY(
+ (float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_ROTATE_Y));
view.setScaleX(
(float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_SCALE_X));
view.setScaleY(
@@ -154,6 +160,8 @@ private static void resetTransformMatrix(View view) {
view.setTranslationX(PixelUtil.toPixelFromDIP(0));
view.setTranslationY(PixelUtil.toPixelFromDIP(0));
view.setRotation(0);
+ view.setRotationX(0);
+ view.setRotationY(0);
view.setScaleX(1);
view.setScaleY(1);
}

0 comments on commit 96553cf

Please sign in to comment.