@@ -151,21 +151,24 @@ private void UpdateVariations ()
151
151
152
152
// Hook into the delete button's frame change, so we can fire off some drawing. If there's a better way, let me know.
153
153
this . deleteVariantButton . AddObserver ( this , new NSString ( FrameChangedObservableProperty ) , NSKeyValueObservingOptions . New , IntPtr . Zero ) ;
154
- }
154
+ }
155
+
156
+ // Cache these before the loop
157
+ var variationBgColour = HostResources . GetNamedColor ( NamedResources . FrameBoxButtonBackgroundColor ) ;
155
158
156
159
NSView previousControl = this . deleteVariantButton ;
157
160
foreach ( PropertyVariationOption item in this . viewModelAsPropertyViewModel . Variation ) {
158
- var selectedVariationTextField = new UnfocusableTextField {
159
- BackgroundColor = HostResources . GetNamedColor ( NamedResources . FrameBoxButtonBackgroundColor ) ,
161
+ var selectedVariationTextField = new UnfocusableTextField {
162
+ BackgroundColor = variationBgColour ,
160
163
Bordered = false ,
161
- Font = NSFont . SystemFontOfSize ( NSFont . SystemFontSizeForControlSize ( NSControlSize . Small ) - 1f ) ,
164
+ Font = VariationOptionFont ,
162
165
TranslatesAutoresizingMaskIntoConstraints = false ,
163
166
StringValue = string . Format ( " {0}: {1} " , item . Category , item . Name ) ,
164
167
} ;
165
168
166
169
AddSubview ( selectedVariationTextField ) ;
167
- AddConstraints ( new [ ] {
168
- NSLayoutConstraint . Create ( selectedVariationTextField , NSLayoutAttribute . Top , NSLayoutRelation . Equal , this , NSLayoutAttribute . Top , 1f , 5f ) ,
170
+ AddConstraints ( new [ ] {
171
+ NSLayoutConstraint . Create ( selectedVariationTextField , NSLayoutAttribute . Top , NSLayoutRelation . Equal , this , NSLayoutAttribute . Top , 1f , VariationBorderOffset ) ,
169
172
NSLayoutConstraint . Create ( selectedVariationTextField , NSLayoutAttribute . Left , NSLayoutRelation . Equal , previousControl , NSLayoutAttribute . Right , 1f , 6f ) ,
170
173
NSLayoutConstraint . Create ( selectedVariationTextField , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 16f ) ,
171
174
} ) ;
@@ -315,6 +318,8 @@ public NSColor LabelTextColor {
315
318
private VariationButton addVariantButton ;
316
319
private const float treeLineLeftEdge = 14f ;
317
320
private const float treeLineLeafIndent = 4f ;
321
+ internal const float VariationBorderOffset = 5f ;
322
+ internal static NSFont VariationOptionFont = NSFont . SystemFontOfSize ( NSFont . SystemFontSizeForControlSize ( NSControlSize . Small ) - 1f ) ;
318
323
private nfloat ViewVariationChildVerticalDrawPoint => this . deleteVariantButton . Frame . Top + 5 ;
319
324
private nfloat ViewVariationParentVerticalDrawPoint => this . addVariantButton . Frame . Top - 2 ;
320
325
private PropertyViewModel viewModelAsPropertyViewModel ;
0 commit comments