Refill zones only when required

Previous implementation refilled zones every time they have been
unselected. This patch adds a flag that tracks whether the
zone has been actually modified, so it will be refilled only when
necessary.

Fixes: lp:1760903
* https://bugs.launchpad.net/kicad/+bug/1760903
This commit is contained in:
Maciej Suminski 2018-04-03 22:26:01 +02:00
parent a2f118d2fa
commit 7943372e8b
2 changed files with 10 additions and 4 deletions

View File

@ -226,6 +226,7 @@ POINT_EDITOR::POINT_EDITOR() :
void POINT_EDITOR::Reset( RESET_REASON aReason )
{
m_refill = false;
m_editPoints.reset();
m_altConstraint.reset();
getViewControls()->SetAutoPan( false );
@ -295,6 +296,7 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
view->Add( m_editPoints.get() );
setEditedPoint( nullptr );
m_refill = false;
bool modified = false;
bool revert = false;
@ -352,8 +354,9 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
if( modified )
{
commit.Push( _( "Drag a line ending" ) );
commit.Push( _( "Drag a corner" ) );
modified = false;
m_refill = true;
}
m_toolMgr->PassEvent();
@ -383,9 +386,8 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
if( modified && revert )
commit.Revert();
else
finishItem();
finishItem();
m_editPoints.reset();
}
@ -575,7 +577,7 @@ void POINT_EDITOR::finishItem()
{
auto zone = static_cast<ZONE_CONTAINER*>( item );
if( zone->IsFilled() )
if( zone->IsFilled() && m_refill )
{
ZONE_FILLER filler( board() );
filler.Fill( { zone } );
@ -1064,6 +1066,7 @@ int POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
int POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent )
{
m_refill = true; // zone has been modified outside the point editor tool
updatePoints();
return 0;
}

View File

@ -80,6 +80,9 @@ private:
// EDIT_POINT for alternative constraint mode
EDIT_POINT m_altConstrainer;
// Flag indicating whether the selected zone needs to be refilled
bool m_refill;
std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
///> Updates item's points with edit points.