Better fix for missing end segment
Rather than skipping our endEdit() call in libedit, we need to parameterize whether we want the shape open/closed. Closed will remove the last segment if it lands on the first point. We don't want that but we do want to remove the last point if it duplicates the second to last (in the case of double-clicking) Fixes https://gitlab.com/kicad/code/kicad/issues/10334
This commit is contained in:
parent
a74d1d9962
commit
55020c2b89
|
@ -1388,7 +1388,7 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
|
|||
}
|
||||
|
||||
|
||||
void EDA_SHAPE::endEdit()
|
||||
void EDA_SHAPE::endEdit( bool aClosed )
|
||||
{
|
||||
switch( GetShape() )
|
||||
{
|
||||
|
@ -1407,7 +1407,7 @@ void EDA_SHAPE::endEdit()
|
|||
{
|
||||
if( poly.CPoint( poly.GetPointCount() - 2 ) == poly.CLastPoint() )
|
||||
{
|
||||
poly.SetClosed( true );
|
||||
poly.SetClosed( aClosed );
|
||||
poly.Remove( poly.GetPointCount() - 1 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,10 +75,7 @@ public:
|
|||
bool ContinueEdit( const wxPoint& aPosition ) override { return continueEdit( aPosition ); }
|
||||
void CalcEdit( const wxPoint& aPosition ) override { calcEdit( aPosition ); }
|
||||
|
||||
/**
|
||||
* The base EndEdit() removes the last point in the polyline, so don't call that here
|
||||
*/
|
||||
void EndEdit() override { }
|
||||
void EndEdit() override { endEdit( false ); }
|
||||
void SetEditState( int aState ) { setEditState( aState ); }
|
||||
|
||||
void AddPoint( const wxPoint& aPosition );
|
||||
|
|
|
@ -288,7 +288,12 @@ protected:
|
|||
void beginEdit( const wxPoint& aStartPoint );
|
||||
bool continueEdit( const wxPoint& aPosition );
|
||||
void calcEdit( const wxPoint& aPosition );
|
||||
void endEdit();
|
||||
|
||||
/**
|
||||
* Finishes editing the shape.
|
||||
* @param aClosed Should polygon shapes be closed (yes for pcbnew/fpeditor, no for libedit)
|
||||
*/
|
||||
void endEdit( bool aClosed = true );
|
||||
void setEditState( int aState ) { m_editState = aState; }
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue