mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
Add rotateX and rotateY transforms to Android Views .
Summary: Setting rotateX and rotateY for Android Views. Closes https://github.com/facebook/react-native/pull/4413 Reviewed By: svcscm Differential Revision: D2741328 Pulled By: mkonicek fb-gh-sync-id: 931027c006bc571ef374a7b82cc7074b8a34bc8d
This commit is contained in:
committed by
facebook-github-bot-8
parent
64a78ed74b
commit
96553cf553
@@ -465,10 +465,10 @@ var MatrixMath = {
|
|||||||
|
|
||||||
// Solve the equation by inverting perspectiveMatrix and multiplying
|
// Solve the equation by inverting perspectiveMatrix and multiplying
|
||||||
// rightHandSide by the inverse.
|
// rightHandSide by the inverse.
|
||||||
var inversePerspectiveMatrix = MatrixMath.inverse3x3(
|
var inversePerspectiveMatrix = MatrixMath.inverse(
|
||||||
perspectiveMatrix
|
perspectiveMatrix
|
||||||
);
|
);
|
||||||
var transposedInversePerspectiveMatrix = MatrixMath.transpose4x4(
|
var transposedInversePerspectiveMatrix = MatrixMath.transpose(
|
||||||
inversePerspectiveMatrix
|
inversePerspectiveMatrix
|
||||||
);
|
);
|
||||||
var perspective = MatrixMath.multiplyVectorByMatrix(
|
var perspective = MatrixMath.multiplyVectorByMatrix(
|
||||||
@@ -583,6 +583,8 @@ var MatrixMath = {
|
|||||||
translation,
|
translation,
|
||||||
|
|
||||||
rotate: rotationDegrees[2],
|
rotate: rotationDegrees[2],
|
||||||
|
rotateX: rotationDegrees[0],
|
||||||
|
rotateY: rotationDegrees[1],
|
||||||
scaleX: scale[0],
|
scaleX: scale[0],
|
||||||
scaleY: scale[1],
|
scaleY: scale[1],
|
||||||
translateX: translation[0],
|
translateX: translation[0],
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
|||||||
private static final String PROP_BACKGROUND_COLOR = ViewProps.BACKGROUND_COLOR;
|
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 = "decomposedMatrix";
|
||||||
private static final String PROP_DECOMPOSED_MATRIX_ROTATE = "rotate";
|
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_X = "scaleX";
|
||||||
private static final String PROP_DECOMPOSED_MATRIX_SCALE_Y = "scaleY";
|
private static final String PROP_DECOMPOSED_MATRIX_SCALE_Y = "scaleY";
|
||||||
private static final String PROP_DECOMPOSED_MATRIX_TRANSLATE_X = "translateX";
|
private static final String PROP_DECOMPOSED_MATRIX_TRANSLATE_X = "translateX";
|
||||||
@@ -144,6 +146,10 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
|||||||
(float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_TRANSLATE_Y)));
|
(float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_TRANSLATE_Y)));
|
||||||
view.setRotation(
|
view.setRotation(
|
||||||
(float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_ROTATE));
|
(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(
|
view.setScaleX(
|
||||||
(float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_SCALE_X));
|
(float) matrix.getDouble(PROP_DECOMPOSED_MATRIX_SCALE_X));
|
||||||
view.setScaleY(
|
view.setScaleY(
|
||||||
@@ -154,6 +160,8 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
|||||||
view.setTranslationX(PixelUtil.toPixelFromDIP(0));
|
view.setTranslationX(PixelUtil.toPixelFromDIP(0));
|
||||||
view.setTranslationY(PixelUtil.toPixelFromDIP(0));
|
view.setTranslationY(PixelUtil.toPixelFromDIP(0));
|
||||||
view.setRotation(0);
|
view.setRotation(0);
|
||||||
|
view.setRotationX(0);
|
||||||
|
view.setRotationY(0);
|
||||||
view.setScaleX(1);
|
view.setScaleX(1);
|
||||||
view.setScaleY(1);
|
view.setScaleY(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user