diff options
author | Bertrand Le Roy <beleroy@microsoft.com> | 2018-10-04 03:09:46 +0300 |
---|---|---|
committer | Bertrand Le Roy <beleroy@microsoft.com> | 2018-10-04 22:08:50 +0300 |
commit | 048171b984070f036a9a9c902c523761195f3b5d (patch) | |
tree | 01720a12466095b1308291df7d3270aeb9625df1 /Xamarin.PropertyEditing.Mac/Controls | |
parent | e2cb77d8a399fccc048b2869e0236fc3644f1a47 (diff) |
Fix color picker layout issues with unexpected popup dimensions
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs | 3 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/SolidColorBrushEditor.cs | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs index ce5509e..3349190 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs @@ -233,6 +233,9 @@ namespace Xamarin.PropertyEditing.Mac { base.Layout (); + if (Frame.IsEmpty || Frame.IsInfinite () || double.IsNaN (Frame.X) || double.IsInfinity (Frame.X)) + return; + var frame = Bounds.Inset (padding, padding); var labelFrame = new CGRect (frame.X, frame.Height - DefaultControlHeight, 20, DefaultControlHeight); var editorFrame = new CGRect (labelFrame.Right, labelFrame.Y, frame.Width - labelFrame.Right, DefaultControlHeight); diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/SolidColorBrushEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/SolidColorBrushEditor.cs index 75ddb6d..7813f5f 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/SolidColorBrushEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/SolidColorBrushEditor.cs @@ -188,8 +188,9 @@ namespace Xamarin.PropertyEditing.Mac this.componentBackground.BackgroundColor = NSColor.ControlBackground.CGColor; this.componentBackground.Frame = new CGRect (0, 0, Frame.Height, Frame.Height); - var x = Frame.Height + 4 * padding; - this.componentBackground.Frame = new CGRect (Frame.Height + 4 * padding, 0, Frame.Width - x, Frame.Height); + var x = firstStop + secondarySpan + 4 * padding; + var backgroundFrame = new CGRect (x, 0, Math.Max(Frame.Width - x, 180), Frame.Height); + this.componentBackground.Frame = backgroundFrame; this.hueLayer.Frame = new CGRect (firstStop, secondBase, secondarySpan, primarySpan); this.hueLayer.GripColor = NSColor.Text.CGColor; @@ -201,7 +202,8 @@ namespace Xamarin.PropertyEditing.Mac editor.UpdateFromModel (inter); } - this.componentTabs.View.Frame = this.componentBackground.Frame.Inset (4 * padding, 2 * padding); + var inset = backgroundFrame.Inset (4 * padding, 2 * padding); + this.componentTabs.View.Frame = inset; } } } |