partial void Apply(bool isSizeChanged, bool isOriginChanged) { if (_isDeferring) { return; } #else partial void Apply(bool isSizeChanged, bool isOriginChanged) { #endif if (Transform.IsAnimating) { // While animating the transform, we let the Animator apply the transform by itself, so do not update the Transform if (!_wasAnimating) { // At the beginning of the animation make sure we disable all properties of the transform Owner.Layer.AnchorPoint = GPUFloatValueAnimator.GetAnchorForAnimation(Transform, CurrentOrigin, CurrentSize); Owner.Layer.Transform = CoreAnimation.CATransform3D.Identity; _wasAnimating = true; } return; } else if (_wasAnimating) { // Make sure to fully restore the transform at the end of an animation Owner.Layer.AnchorPoint = CurrentOrigin; Owner.Layer.Transform = _transform = Transform.MatrixCore.ToTransform3D(); _wasAnimating = false; return; } if (isSizeChanged) { // As we use the 'AnchorPoint', the transform matrix is independent of the size of the control // But the layouter expects from us that we restore the transform on each measuring phase Owner.Layer.Transform = _transform; } else if (isOriginChanged) { Owner.Layer.AnchorPoint = CurrentOrigin; } else { Owner.Layer.Transform = _transform = Transform.MatrixCore.ToTransform3D(); } }
partial void Apply(bool isSizeChanged, bool isOriginChanged) { if (Transform.IsAnimating) { // While animating the transform, we let the Animator apply the transform by itself, so do not update the Transform #if __IOS__ Owner.Layer.AnchorPoint = GPUFloatValueAnimator.GetAnchorForAnimation(Transform, CurrentOrigin, CurrentSize); _wasAnimating = true; return; #else throw new InvalidOperationException("Should not be 'IsAnimating' on this platform"); #endif } else if (_wasAnimating) { // Make sure to fully restore the transform at the end of an animation Owner.Layer.AnchorPoint = CurrentOrigin; Owner.Layer.Transform = _transform = Transform.MatrixCore.ToTransform3D(); _wasAnimating = false; return; } if (isSizeChanged) { // As we use the 'AnchorPoint', the transform matrix is independent of the size of the control // But the layouter expects from us that we restore the transform on each measuring phase Owner.Layer.Transform = _transform; } else if (isOriginChanged) { Owner.Layer.AnchorPoint = CurrentOrigin; } else { Owner.Layer.Transform = _transform = Transform.MatrixCore.ToTransform3D(); } }