Don't allow negative line widths to shrink bounding box.

Fixes https://gitlab.com/kicad/code/kicad/issues/9776
This commit is contained in:
Jeff Young 2021-11-29 20:01:41 +00:00
parent 7ccf658379
commit 78be5df39a
7 changed files with 70 additions and 3 deletions

View File

@ -647,7 +647,7 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const
break;
}
bbox.Inflate( m_width / 2 );
bbox.Inflate( std::max( 0, m_width / 2 ) );
bbox.Normalize();
return bbox;

View File

@ -35,6 +35,7 @@ DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aPa
m_lineWidth( aParent, m_widthLabel, m_widthCtrl, m_widthUnits, true )
{
SetTitle( aItem->GetTypeName() + wxT( " " ) + GetTitle() );
m_helpLabel->SetFont( KIUI::GetInfoFont( this ) );
SetInitialFocus( m_widthCtrl );

View File

@ -36,6 +36,10 @@ DIALOG_LIB_SHAPE_PROPERTIES_BASE::DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* pa
dlgBorderSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 );
m_helpLabel = new wxStaticText( this, wxID_ANY, _("Set width to 0 to use Schematic default symbol line width."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel->Wrap( 333 );
dlgBorderSizer->Add( m_helpLabel, 0, wxALL, 5 );
wxString m_fillCtrlChoices[] = { _("Do not fill"), _("Fill with body outline color"), _("Fill with body background color") };
int m_fillCtrlNChoices = sizeof( m_fillCtrlChoices ) / sizeof( wxString );
m_fillCtrl = new wxRadioBox( this, wxID_ANY, _("Fill Style"), wxDefaultPosition, wxDefaultSize, m_fillCtrlNChoices, m_fillCtrlChoices, 1, wxRA_SPECIFY_COLS );

View File

@ -264,6 +264,67 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Set width to 0 to use Schematic default symbol line width.</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_helpLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">333</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>

View File

@ -38,6 +38,7 @@ class DIALOG_LIB_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_widthLabel;
wxTextCtrl* m_widthCtrl;
wxStaticText* m_widthUnits;
wxStaticText* m_helpLabel;
wxRadioBox* m_fillCtrl;
wxCheckBox* m_checkApplyToAllUnits;
wxCheckBox* m_checkApplyToAllConversions;

View File

@ -104,7 +104,7 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
fgSizer321->SetFlexibleDirection( wxBOTH );
fgSizer321->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lineWidthLabel = new wxStaticText( sbSizer41->GetStaticBox(), wxID_ANY, _("Default line thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel = new wxStaticText( sbSizer41->GetStaticBox(), wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel->Wrap( -1 );
fgSizer321->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );

View File

@ -863,7 +863,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Default line thickness:</property>
<property name="label">Default line width:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>