diff options
author | Anthony Bucyk <anbucyk@microsoft.com> | 2019-05-01 01:21:13 +0300 |
---|---|---|
committer | Anthony Bucyk <anbucyk@microsoft.com> | 2019-05-01 01:21:13 +0300 |
commit | 789e46443ad41357b5c2903f303e06143029f3c5 (patch) | |
tree | dd21efe6848014e36b1dc54778c82cc1e364cdb1 /Xamarin.PropertyEditing.Mac/Controls | |
parent | 40c398ae8cb9670696fcb7f0416b441c3dc453b0 (diff) |
Fixes shrinking color rectangles in the color swatch selector. The vertical margin was being added every time the control was being redrawn.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs index 80f992b..9fce3f7 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs @@ -10,6 +10,7 @@ namespace Xamarin.PropertyEditing.Mac : CALayer { private const double VerticalMarginOffset = 0.5; + private CGRect frameRect; public CommonBrushLayer (IHostResourceProvider hostResources) { @@ -72,7 +73,10 @@ namespace Xamarin.PropertyEditing.Mac public override void LayoutSublayers () { base.LayoutSublayers (); - Frame = new CGRect (Frame.X, Bounds.Y + VerticalMargin + VerticalMarginOffset, Bounds.Width, Bounds.Height - (VerticalMargin * 2)); + + if (frameRect.IsEmpty) + frameRect = new CGRect (Frame.X, Bounds.Y + VerticalMargin + VerticalMarginOffset, Bounds.Width, Bounds.Height - (VerticalMargin * 2)); + Frame = frameRect; BrushLayer.Frame = Bounds; Contents = DrawingExtensions.GenerateCheckerboard (Bounds, this.hostResources.GetNamedColor (NamedResources.Checkerboard0Color), this.hostResources.GetNamedColor (NamedResources.Checkerboard1Color)); } |