Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz authored and PureWeen committed Apr 29, 2021
1 parent 39157f7 commit 8f01c17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/Core/src/Handlers/View/ViewHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ public partial class ViewHandler
CALayer? _layer;
bool _isInteractive;
CGPoint? _originalAnchor;
Rectangle? _lastBounds;

partial void SettingDefault(NativeView? nativeView)
{
_layer = nativeView?.Layer;
_isInteractive = nativeView?.UserInteractionEnabled ?? false;
_originalAnchor = _layer?.AnchorPoint;
_lastBounds = Rectangle.Zero;
}

public static void MapTranslationX(IViewHandler handler, IView view)
Expand Down Expand Up @@ -65,8 +67,9 @@ public static void MapTransformation(IViewHandler handler, IView view)
CALayer? layer = viewHandler._layer;
bool isInteractive = viewHandler._isInteractive;
CGPoint? originalAnchor = viewHandler._originalAnchor;
Rectangle? lastBounds = viewHandler._lastBounds;

((NativeView?)handler.NativeView)?.UpdateTransformation(view, layer, isInteractive, originalAnchor);
((NativeView?)handler.NativeView)?.UpdateTransformation(view, layer, isInteractive, originalAnchor, lastBounds);
}
}
}
11 changes: 6 additions & 5 deletions src/Core/src/Platform/iOS/TransformationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ namespace Microsoft.Maui
{
public static class TransformationExtensions
{
static Rectangle LastBounds;

public static void UpdateTransformation(this UIView nativeView, IView? view)
{
CALayer? layer = nativeView.Layer;
bool isInteractive = nativeView.UserInteractionEnabled;
CGPoint? originalAnchor = layer?.AnchorPoint;
Rectangle? lastBounds = view?.Frame;

nativeView.UpdateTransformation(view, layer, isInteractive, originalAnchor);
nativeView.UpdateTransformation(view, layer, isInteractive, originalAnchor, lastBounds);
}

public static void UpdateTransformation(this UIView nativeView, IView? view, CALayer? layer, bool isInteractive, CGPoint? originalAnchor)
public static void UpdateTransformation(this UIView nativeView, IView? view, CALayer? layer, bool isInteractive, CGPoint? originalAnchor, Rectangle? lastBounds)
{
if (view == null)
return;
Expand All @@ -37,7 +36,7 @@ public static void UpdateTransformation(this UIView nativeView, IView? view, CAL
isInteractive = shouldInteract;
}

var boundsChanged = LastBounds != view.Frame;
var boundsChanged = lastBounds != view.Frame;

var anchorX = (float)view.AnchorX;
var anchorY = (float)view.AnchorY;
Expand Down Expand Up @@ -153,6 +152,8 @@ void Update()
// TODO: Use the thread var when porting the Device class.

Update();

lastBounds = view.Frame;
}
}
}

0 comments on commit 8f01c17

Please sign in to comment.