@@ -26,28 +26,44 @@ internal abstract class BaseRectangleEditorControl<T> : PropertyEditorControl<Pr
2626 protected BaseRectangleEditorControl ( IHostResourceProvider hostResources )
2727 : base ( hostResources )
2828 {
29- XLabel = new UnfocusableTextField ( ) ;
30- XEditor = new NumericSpinEditor < T > ( hostResources ) ;
31- XEditor . BackgroundColor = NSColor . Clear ;
32- XEditor . Value = 0.0f ;
29+ XLabel = new UnfocusableTextField {
30+ Font = NSFont . FromFontName ( DefaultFontName , DefaultDescriptionLabelFontSize ) ,
31+ TranslatesAutoresizingMaskIntoConstraints = false ,
32+ } ;
33+ XEditor = new NumericSpinEditor < T > ( hostResources ) {
34+ BackgroundColor = NSColor . Clear ,
35+ Value = 0.0f
36+ } ;
3337 XEditor . ValueChanged += OnInputUpdated ;
3438
35- YLabel = new UnfocusableTextField ( ) ;
36- YEditor = new NumericSpinEditor < T > ( hostResources ) ;
37- YEditor . BackgroundColor = NSColor . Clear ;
38- YEditor . Value = 0.0f ;
39+ YLabel = new UnfocusableTextField {
40+ Font = NSFont . FromFontName ( DefaultFontName , DefaultDescriptionLabelFontSize ) ,
41+ TranslatesAutoresizingMaskIntoConstraints = false ,
42+ } ;
43+ YEditor = new NumericSpinEditor < T > ( hostResources ) {
44+ BackgroundColor = NSColor . Clear ,
45+ Value = 0.0f
46+ } ;
3947 YEditor . ValueChanged += OnInputUpdated ;
4048
41- WidthLabel = new UnfocusableTextField ( ) ;
42- WidthEditor = new NumericSpinEditor < T > ( hostResources ) ;
43- WidthEditor . BackgroundColor = NSColor . Clear ;
44- WidthEditor . Value = 0.0f ;
49+ WidthLabel = new UnfocusableTextField {
50+ Font = NSFont . FromFontName ( DefaultFontName , DefaultDescriptionLabelFontSize ) ,
51+ TranslatesAutoresizingMaskIntoConstraints = false ,
52+ } ;
53+ WidthEditor = new NumericSpinEditor < T > ( hostResources ) {
54+ BackgroundColor = NSColor . Clear ,
55+ Value = 0.0f
56+ } ;
4557 WidthEditor . ValueChanged += OnInputUpdated ;
4658
47- HeightLabel = new UnfocusableTextField ( ) ;
48- HeightEditor = new NumericSpinEditor < T > ( hostResources ) ;
49- HeightEditor . BackgroundColor = NSColor . Clear ;
50- HeightEditor . Value = 0.0f ;
59+ HeightLabel = new UnfocusableTextField {
60+ Font = NSFont . FromFontName ( DefaultFontName , DefaultDescriptionLabelFontSize ) ,
61+ TranslatesAutoresizingMaskIntoConstraints = false ,
62+ } ;
63+ HeightEditor = new NumericSpinEditor < T > ( hostResources ) {
64+ BackgroundColor = NSColor . Clear ,
65+ Value = 0.0f
66+ } ;
5167 HeightEditor . ValueChanged += OnInputUpdated ;
5268
5369 AddSubview ( XLabel ) ;
@@ -60,17 +76,43 @@ protected BaseRectangleEditorControl (IHostResourceProvider hostResources)
6076 AddSubview ( HeightEditor ) ;
6177
6278 this . AddConstraints ( new [ ] {
63- NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , 1f , 90f ) ,
79+ NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , this , NSLayoutAttribute . Top , 1f , 0f ) ,
80+ NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Left , NSLayoutRelation . Equal , this , NSLayoutAttribute . Left , 1f , 0f ) ,
81+ NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , YEditor , NSLayoutAttribute . Left , 1f , - 10f ) ,
6482 NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , DefaultControlHeight ) ,
6583
66- NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , 1f , 90f ) ,
84+ NSLayoutConstraint . Create ( XLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , XEditor , NSLayoutAttribute . Bottom , 1f , - 4f ) ,
85+ NSLayoutConstraint . Create ( XLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , DefaultControlHeight ) ,
86+
87+ NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , this , NSLayoutAttribute . Top , 1f , 0f ) ,
88+ NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , this , NSLayoutAttribute . Right , 1f , - 32f ) ,
89+ NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , XEditor , NSLayoutAttribute . Width , 1f , 0f ) ,
6790 NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , DefaultControlHeight ) ,
6891
69- NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , 1f , 90f ) ,
92+ NSLayoutConstraint . Create ( YLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , XLabel , NSLayoutAttribute . Top , 1f , 0f ) ,
93+ NSLayoutConstraint . Create ( YLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , DefaultControlHeight ) ,
94+
95+ NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , this , NSLayoutAttribute . Top , 1f , 33f ) ,
96+ NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Left , NSLayoutRelation . Equal , this , NSLayoutAttribute . Left , 1f , 0f ) ,
97+ NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , HeightEditor , NSLayoutAttribute . Left , 1f , - 10f ) ,
7098 NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , DefaultControlHeight ) ,
7199
72- NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , 1f , 90f ) ,
100+ NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , WidthEditor , NSLayoutAttribute . Bottom , 1f , - 4f ) ,
101+ NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , DefaultControlHeight ) ,
102+
103+ NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , WidthEditor , NSLayoutAttribute . Top , 1f , 0f ) ,
104+ NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , this , NSLayoutAttribute . Right , 1f , - 32f ) ,
105+ NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , WidthEditor , NSLayoutAttribute . Width , 1f , 0f ) ,
73106 NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , DefaultControlHeight ) ,
107+
108+ NSLayoutConstraint . Create ( HeightLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , WidthLabel , NSLayoutAttribute . Top , 1f , 0f ) ,
109+ NSLayoutConstraint . Create ( HeightLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , DefaultControlHeight ) ,
110+
111+
112+ NSLayoutConstraint . Create ( XLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , XEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
113+ NSLayoutConstraint . Create ( YLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , YEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
114+ NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , WidthEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
115+ NSLayoutConstraint . Create ( HeightLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , HeightEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
74116 } ) ;
75117
76118 ViewDidChangeEffectiveAppearance ( ) ;
0 commit comments