Don't run dimension updates while parsing files.
They mess up the geometry when only partial values are provided. Fixes https://gitlab.com/kicad/code/kicad/issues/7177
This commit is contained in:
parent
25ff0fa662
commit
35978adef9
|
@ -293,20 +293,6 @@ void DIMENSION_BASE::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight )
|
|||
}
|
||||
|
||||
|
||||
void DIMENSION_BASE::SetStart( const wxPoint& aOrigin )
|
||||
{
|
||||
m_start = aOrigin;
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void DIMENSION_BASE::SetEnd( const wxPoint& aEnd )
|
||||
{
|
||||
m_end = aEnd;
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
// for now, display only the text within the DIMENSION using class PCB_TEXT.
|
||||
|
@ -526,13 +512,6 @@ BITMAP_DEF ALIGNED_DIMENSION::GetMenuImage() const
|
|||
}
|
||||
|
||||
|
||||
void ALIGNED_DIMENSION::SetHeight( int aHeight )
|
||||
{
|
||||
m_height = aHeight;
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void ALIGNED_DIMENSION::UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd )
|
||||
{
|
||||
VECTOR2D height( aCrossbarStart - GetStart() );
|
||||
|
@ -670,6 +649,15 @@ void ALIGNED_DIMENSION::updateText()
|
|||
}
|
||||
|
||||
|
||||
void ALIGNED_DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
||||
std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
DIMENSION_BASE::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
aList.emplace_back( _( "Height" ), MessageTextFromValue( aFrame->GetUserUnits(), m_height ) );
|
||||
}
|
||||
|
||||
|
||||
ORTHOGONAL_DIMENSION::ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent ) :
|
||||
ALIGNED_DIMENSION( aParent, PCB_DIM_ORTHOGONAL_T )
|
||||
{
|
||||
|
|
|
@ -119,10 +119,10 @@ public:
|
|||
* @return the origin point of this dimension
|
||||
*/
|
||||
virtual const wxPoint& GetStart() const { return m_start; }
|
||||
virtual void SetStart( const wxPoint& aPoint );
|
||||
virtual void SetStart( const wxPoint& aPoint ) { m_start = aPoint; }
|
||||
|
||||
virtual const wxPoint& GetEnd() const { return m_end; }
|
||||
virtual void SetEnd( const wxPoint& aPoint );
|
||||
virtual void SetEnd( const wxPoint& aPoint ) { m_end = aPoint; }
|
||||
|
||||
wxPoint GetPosition() const override { return m_start; }
|
||||
void SetPosition( const wxPoint& aPos ) override { m_start = aPos; }
|
||||
|
@ -363,7 +363,7 @@ public:
|
|||
* Sets the distance from the feature points to the crossbar line
|
||||
* @param aHeight is the new height.
|
||||
*/
|
||||
void SetHeight( int aHeight );
|
||||
void SetHeight( int aHeight ) { m_height = aHeight; }
|
||||
int GetHeight() const { return m_height; }
|
||||
|
||||
/**
|
||||
|
@ -392,6 +392,8 @@ public:
|
|||
return wxT( "ALIGNED_DIMENSION" );
|
||||
}
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
protected:
|
||||
|
||||
void updateGeometry() override;
|
||||
|
|
|
@ -632,6 +632,7 @@ void DRAWING_TOOL::constrainDimension( DIMENSION_BASE* aDim )
|
|||
const VECTOR2I lineVector{ aDim->GetEnd() - aDim->GetStart() };
|
||||
|
||||
aDim->SetEnd( wxPoint( VECTOR2I( aDim->GetStart() ) + GetVectorSnapped45( lineVector ) ) );
|
||||
aDim->Update();
|
||||
}
|
||||
|
||||
|
||||
|
@ -826,6 +827,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
dimension->SetExtensionOffset( boardSettings.m_DimensionExtensionOffset );
|
||||
dimension->SetStart( (wxPoint) cursorPos );
|
||||
dimension->SetEnd( (wxPoint) cursorPos );
|
||||
dimension->Update();
|
||||
|
||||
preview.Add( dimension );
|
||||
frame()->SetMsgPanel( dimension );
|
||||
|
@ -838,6 +840,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
case SET_END:
|
||||
{
|
||||
dimension->SetEnd( (wxPoint) cursorPos );
|
||||
dimension->Update();
|
||||
|
||||
if( !!evt->Modifier( MD_CTRL ) || dimension->Type() == PCB_DIM_CENTER_T )
|
||||
constrainDimension( dimension );
|
||||
|
@ -903,6 +906,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
case SET_END:
|
||||
dimension->SetEnd( (wxPoint) cursorPos );
|
||||
dimension->Update();
|
||||
|
||||
if( !!evt->Modifier( MD_CTRL ) || dimension->Type() == PCB_DIM_CENTER_T )
|
||||
constrainDimension( dimension );
|
||||
|
@ -921,6 +925,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
wxPoint delta( (wxPoint) cursorPos - dimension->GetEnd() );
|
||||
double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
|
||||
aligned->SetHeight( height );
|
||||
aligned->Update();
|
||||
}
|
||||
else if( dimension->Type() == PCB_DIM_ORTHOGONAL_T )
|
||||
{
|
||||
|
@ -944,6 +949,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
|
||||
VECTOR2I heightVector( cursorPos - dimension->GetStart() );
|
||||
ortho->SetHeight( vert ? heightVector.x : heightVector.y );
|
||||
ortho->Update();
|
||||
}
|
||||
else if( dimension->Type() == PCB_DIM_LEADER_T )
|
||||
{
|
||||
|
|
|
@ -1388,8 +1388,9 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
dimension->SetHeight( -featureLine.EuclideanNorm() );
|
||||
else
|
||||
dimension->SetHeight( featureLine.EuclideanNorm() );
|
||||
}
|
||||
|
||||
dimension->Update();
|
||||
}
|
||||
else if( isModified( m_editPoints->Point( DIM_CROSSBAREND ) ) )
|
||||
{
|
||||
VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetEnd() );
|
||||
|
@ -1399,28 +1400,31 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
dimension->SetHeight( -featureLine.EuclideanNorm() );
|
||||
else
|
||||
dimension->SetHeight( featureLine.EuclideanNorm() );
|
||||
}
|
||||
|
||||
dimension->Update();
|
||||
}
|
||||
else if( isModified( m_editPoints->Point( DIM_START ) ) )
|
||||
{
|
||||
dimension->SetStart( wxPoint( m_editedPoint->GetPosition().x,
|
||||
m_editedPoint->GetPosition().y ) );
|
||||
dimension->Update();
|
||||
|
||||
m_editPoints->Point( DIM_CROSSBARSTART ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARSTART ),
|
||||
m_editPoints->Point( DIM_START ) ) );
|
||||
m_editPoints->Point( DIM_CROSSBAREND ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBAREND ),
|
||||
m_editPoints->Point( DIM_END ) ) );
|
||||
}
|
||||
|
||||
else if( isModified( m_editPoints->Point( DIM_END ) ) )
|
||||
{
|
||||
dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x,
|
||||
m_editedPoint->GetPosition().y ) );
|
||||
dimension->Update();
|
||||
|
||||
m_editPoints->Point( DIM_CROSSBARSTART ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARSTART ),
|
||||
m_editPoints->Point( DIM_START ) ) );
|
||||
m_editPoints->Point( DIM_CROSSBAREND ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBAREND ),
|
||||
m_editPoints->Point( DIM_END ) ) );
|
||||
}
|
||||
|
||||
else if( isModified( m_editPoints->Point(DIM_TEXT ) ) )
|
||||
{
|
||||
// Force manual mode if we weren't already in it
|
||||
|
@ -1472,9 +1476,10 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
// Force manual mode if we weren't already in it
|
||||
dimension->SetTextPositionMode( DIM_TEXT_POSITION::MANUAL );
|
||||
dimension->Text().SetPosition( wxPoint( m_editedPoint->GetPosition() ) );
|
||||
dimension->Update();
|
||||
}
|
||||
|
||||
dimension->Update();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue