Skip to content

Commit f87b06d

Browse files
pre10der89matthargett
authored andcommitted
Support WPF Affline Transformations (rotate,scale,skew,translate) (microsoft#1099)
* Closes microsoft#1076 * Enabling support for affline transformations rotate, scale, skew, translate
1 parent 97172a8 commit f87b06d

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

ReactWindows/ReactNative.Net46/Shell/MainReactPackage.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using ReactNative.Bridge;
1+
using ReactNative.Animated;
2+
using ReactNative.Bridge;
23
using ReactNative.Modules.AppState;
34
using ReactNative.Modules.Clipboard;
45
using ReactNative.Modules.Core;
@@ -48,7 +49,7 @@ public IReadOnlyList<INativeModule> CreateNativeModules(ReactContext reactContex
4849
new I18NModule(),
4950
//new LauncherModule(reactContext),
5051
//new LocationModule(reactContext),
51-
//new NativeAnimatedModule(reactContext),
52+
new NativeAnimatedModule(reactContext),
5253
new NetworkingModule(reactContext),
5354
new NetInfoModule(reactContext),
5455
//new StatusBarModule(),

ReactWindows/ReactNative.Net46/UIManager/BaseViewManager.cs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,18 +169,32 @@ private static void SetProjectionMatrix(TFrameworkElement view, JArray transform
169169

170170
private static void ApplyProjection(TFrameworkElement view, Matrix3D projectionMatrix)
171171
{
172-
if (!IsSimpleTranslationOnly(projectionMatrix))
172+
if (!projectionMatrix.IsAffine)
173173
{
174-
throw new InvalidOperationException("ReactNative.Net46 does not support 3D transformations");
174+
throw new NotImplementedException("ReactNative.Net46 does not support non-affine transformations");
175175
}
176176

177-
ResetProjectionMatrix(view);
178-
var transform = new MatrixTransform();
179-
var matrix = transform.Matrix;
180-
matrix.OffsetX = projectionMatrix.OffsetX;
181-
matrix.OffsetY = projectionMatrix.OffsetY;
182-
transform.Matrix = matrix;
183-
view.RenderTransform = transform;
177+
if (IsSimpleTranslationOnly(projectionMatrix))
178+
{
179+
ResetProjectionMatrix(view);
180+
var transform = new MatrixTransform();
181+
var matrix = transform.Matrix;
182+
matrix.OffsetX = projectionMatrix.OffsetX;
183+
matrix.OffsetY = projectionMatrix.OffsetY;
184+
transform.Matrix = matrix;
185+
view.RenderTransform = transform;
186+
}
187+
else
188+
{
189+
var transform = new MatrixTransform(projectionMatrix.M11,
190+
projectionMatrix.M12,
191+
projectionMatrix.M21,
192+
projectionMatrix.M22,
193+
projectionMatrix.OffsetX,
194+
projectionMatrix.OffsetY);
195+
196+
view.RenderTransform = transform;
197+
}
184198
}
185199

186200
private static bool IsSimpleTranslationOnly(Matrix3D matrix)

0 commit comments

Comments
 (0)