Skip to content

Commit a2c7031

Browse files
committed
Scale Outline controls by natural width
Previously, the Outline/Shadow spinboxes and the Border Style combobox shared a fixed sizer proportion of 1. Because the combobox has a much wider natural size than the spinboxes, the wxBoxSizer forced the spinboxes to stretch excessively to match the combobox's width. This changes `add_with_label` to use the control's natural width (`GetBestSize().GetWidth()`) as its sizer proportion instead of a fixed value. By weighting the proportion based on width, the layout achieves two goals: 1. At the default dialog size, the spinboxes are not forced to expand to match the wider combobox, allowing them to retain their compact, natural size. 2. When the dialog is resized horizontally, all controls expand together, distributing the extra space relative to their original widths, rather than the combobox remaining fixed or the spinboxes growing disproportionately.
1 parent 0516975 commit a2c7031

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dialog_style_editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
145145

146146
auto add_with_label = [&](wxSizer *sizer, wxString const& label, wxWindow *ctrl) {
147147
sizer->Add(new wxStaticText(this, -1, label), wxSizerFlags().Center().Border(wxLEFT | wxRIGHT));
148-
sizer->Add(ctrl, wxSizerFlags(1).Left().Expand());
148+
sizer->Add(ctrl, wxSizerFlags(ctrl->GetBestSize().GetWidth()).Left().Expand());
149149
};
150150

151151
auto num_text_ctrl = [&](double *value, double min, double max, double step, int precision) -> wxSpinCtrlDouble * {

0 commit comments

Comments
 (0)