Stop text from causing a shift during flip when >1 items are selected

1e1be730 fixed this only for one item.

Fixes https://gitlab.com/kicad/code/kicad/issues/7304
This commit is contained in:
Mikolaj Wielgus 2021-03-15 00:03:40 +01:00 committed by Seth Hillbrand
parent 2bafc1af00
commit c3c3649211
2 changed files with 13 additions and 9 deletions

View File

@ -272,13 +272,6 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
rect.SetOrigin( pos ); rect.SetOrigin( pos );
// The bbox vertical size returned by GetInterline( aThickness )
// includes letters like j and y and ] + interval between lines.
// The interval below the last line is not usefull, and we can use its half value
// as vertical margin above the text
// the full interval is roughly GetTextHeight() * 0.4 - aThickness/2
rect.Move( wxPoint( 0, thickness/4 - KiROUND( GetTextHeight() * 0.22 ) ) );
if( hasOverBar ) if( hasOverBar )
{ // A overbar adds an extra size to the text { // A overbar adds an extra size to the text
// Height from the base line text of chars like [ or { // Height from the base line text of chars like [ or {
@ -329,8 +322,6 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
break; break;
} }
dy = GetTextHeight() + thickness;
switch( GetVertJustify() ) switch( GetVertJustify() )
{ {
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:

View File

@ -35,6 +35,7 @@
#include <pcb_marker.h> #include <pcb_marker.h>
#include <dimension.h> #include <dimension.h>
#include <pcb_target.h> #include <pcb_target.h>
#include <advanced_config.h>
#include <core/arraydim.h> #include <core/arraydim.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
@ -411,6 +412,18 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
if( !item ) if( !item )
return false; return false;
if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
{
// Show bounding boxes of painted objects for debugging.
EDA_RECT box = item->GetBoundingBox();
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
m_gal->SetLineWidth( Mils2iu( 3 ) );
m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
}
// the "cast" applied in here clarifies which overloaded draw() is called // the "cast" applied in here clarifies which overloaded draw() is called
switch( item->Type() ) switch( item->Type() )
{ {