@@ -12,13 +12,19 @@ public sealed partial class DefaultLayoutEngine
1212 private const double WireframeContainerPad = 12.0 ;
1313 private const double WireframeDefaultWidth = 320.0 ;
1414 private const double WireframeButtonHeight = 34.0 ;
15+ private const double WireframeButtonMinWidthRatio = 0.4 ; // fraction of DefaultWidth
16+ private const double WireframeButtonHPad = 32.0 ; // horizontal text padding in button
1517 private const double WireframeInputHeight = 32.0 ;
1618 private const double WireframeControlHeight = 22.0 ;
19+ private const double WireframeControlLabelGap = 8.0 ; // space between control and its label
20+ private const double WireframeControlMinWidth = 120.0 ; // minimum width for checkbox/radio
1721 private const double WireframeToggleWidth = 48.0 ;
1822 private const double WireframeToggleHeight = 24.0 ;
1923 private const double WireframeTabBarHeight = 38.0 ;
2024 private const double WireframeDividerHeight = 4.0 ;
2125 private const double WireframeBadgeHeight = 20.0 ;
26+ private const double WireframeBadgeMinWidth = 36.0 ; // minimum badge pill width
27+ private const double WireframeBadgeHPad = 16.0 ; // horizontal padding inside badge
2228 private const double WireframeImageHeight = 100.0 ;
2329 private const double WireframeImageWidth = 160.0 ;
2430 private const double WireframeH1FontSize = 20.0 ;
@@ -136,7 +142,7 @@ private static void SizeWireframeLeaf(Node node, Theme theme)
136142 case "button" :
137143 {
138144 double textW = SvgRenderSupport . EstimateTextWidth ( node . Label . Text , theme . FontSize ) ;
139- node . Width = Math . Max ( WireframeDefaultWidth * 0.4 , textW + 32 ) ;
145+ node . Width = Math . Max ( WireframeDefaultWidth * WireframeButtonMinWidthRatio , textW + WireframeButtonHPad ) ;
140146 node . Height = WireframeButtonHeight ;
141147 break ;
142148 }
@@ -149,15 +155,15 @@ private static void SizeWireframeLeaf(Node node, Theme theme)
149155 case "radio" :
150156 {
151157 double textW = SvgRenderSupport . EstimateTextWidth ( node . Label . Text , theme . FontSize ) ;
152- node . Width = Math . Max ( 120 , WireframeControlHeight + 8 + textW ) ;
158+ node . Width = Math . Max ( WireframeControlMinWidth , WireframeControlHeight + WireframeControlLabelGap + textW ) ;
153159 node . Height = WireframeControlHeight ;
154160 break ;
155161 }
156162 case "toggle" :
157163 node . Width = WireframeToggleWidth
158164 + ( string . IsNullOrWhiteSpace ( node . Label . Text )
159165 ? 0
160- : 8 + SvgRenderSupport . EstimateTextWidth ( node . Label . Text , theme . FontSize ) ) ;
166+ : WireframeControlLabelGap + SvgRenderSupport . EstimateTextWidth ( node . Label . Text , theme . FontSize ) ) ;
161167 node . Height = WireframeToggleHeight ;
162168 break ;
163169
@@ -175,7 +181,7 @@ private static void SizeWireframeLeaf(Node node, Theme theme)
175181 {
176182 double badgeFontSize = theme . FontSize * 0.8 ;
177183 double textW = SvgRenderSupport . EstimateTextWidth ( node . Label . Text , badgeFontSize ) ;
178- node . Width = Math . Max ( 36 , textW + 16 ) ;
184+ node . Width = Math . Max ( WireframeBadgeMinWidth , textW + WireframeBadgeHPad ) ;
179185 node . Height = WireframeBadgeHeight ;
180186 break ;
181187 }
0 commit comments