Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit d5b24c9

Browse files
author
Eric Maupin
committed
[mac] Make inline color editor scale down
1 parent 064f3ae commit d5b24c9

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Xamarin.PropertyEditing.Mac/Controls/Custom/SolidColorBrushEditor.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,15 @@ public override void Layout ()
183183

184184
const float spacing = 8, hueWidth = 20, historyHeight = 20;
185185
const float leftMinWidth = hueWidth + (Padding * 2) + 50;
186-
const float rightMinWidth = 125;
187-
const float rightRatio = 0.85f;
186+
const float rightWidth = 170;
187+
188+
nfloat leftWidth = leftMinWidth;
189+
190+
nfloat spaceLeft = Frame.Width - spacing - leftWidth - rightWidth;
191+
if (spaceLeft > 0) {
192+
leftWidth += spaceLeft;
193+
}
188194

189-
nfloat hspace = Frame.Width - spacing;
190-
float leftWidth = Math.Max ((float)(hspace / 2) * (1 + (1 - rightRatio)), leftMinWidth);
191-
float rightWidth = Math.Max ((float)(hspace - leftWidth), rightMinWidth);
192195
nfloat vspace = Frame.Height - (Padding * 2);
193196

194197
this.background.Frame = new CGRect (0, 0, leftWidth, Frame.Height);
@@ -198,9 +201,10 @@ public override void Layout ()
198201
this.historyLayer.Frame = new CGRect (Padding, Padding, shadeFrame.Width, historyHeight);
199202
this.hueLayer.Frame = new CGRect (this.shadeLayer.Frame.Right + Padding, this.historyLayer.Frame.Bottom + Padding, hueWidth, shadeFrame.Height);
200203

204+
const float componentPadding = 9;
201205
var backgroundFrame = new CGRect (this.hueLayer.Frame.Right + spacing, 0, rightWidth, Frame.Height);
202206
this.componentBackground.Frame = backgroundFrame;
203-
var inset = backgroundFrame.Inset (4 * Padding, 2 * Padding);
207+
var inset = backgroundFrame.Inset (componentPadding, componentPadding);
204208
this.componentTabs.View.Frame = inset;
205209

206210
var inter = interaction ?? new EditorInteraction (ViewModel, null);

Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ protected IHostResourceProvider HostResources
146146
private IUnderliningTabView selected;
147147
private DynamicFillBox tabContainer, border;
148148
private NSStackView innerStack;
149-
private NSStackView tabStack = new NSStackView () {
150-
Spacing = 10f,
149+
private readonly NSStackView tabStack = new NSStackView () {
150+
Spacing = 1f,
151151
};
152152

153153
protected NSStackView TabStack => this.tabStack;

0 commit comments

Comments
 (0)