Grid helpers: remove view items on destruction

This commit is contained in:
Mike Williams 2023-10-23 09:39:08 -04:00
parent 9e48c0b695
commit 91b6bb8088
4 changed files with 22 additions and 0 deletions

View File

@ -62,6 +62,16 @@ EE_GRID_HELPER::EE_GRID_HELPER( TOOL_MANAGER* aToolMgr ) :
}
EE_GRID_HELPER::~EE_GRID_HELPER()
{
KIGFX::VIEW* view = m_toolMgr->GetView();
view->Remove( &m_viewAxis );
view->Remove( &m_viewSnapPoint );
view->Remove( &m_viewSnapLine );
}
VECTOR2I EE_GRID_HELPER::BestDragOrigin( const VECTOR2I& aMousePos, GRID_HELPER_GRIDS aGrid,
const EE_SELECTION& aItems )
{

View File

@ -40,6 +40,7 @@ class EE_GRID_HELPER : public GRID_HELPER
public:
EE_GRID_HELPER( TOOL_MANAGER* aToolMgr );
~EE_GRID_HELPER() override;
/**
* Function GetSnapped

View File

@ -79,6 +79,16 @@ PCB_GRID_HELPER::PCB_GRID_HELPER( TOOL_MANAGER* aToolMgr, MAGNETIC_SETTINGS* aMa
}
PCB_GRID_HELPER::~PCB_GRID_HELPER()
{
KIGFX::VIEW* view = m_toolMgr->GetView();
view->Remove( &m_viewAxis );
view->Remove( &m_viewSnapPoint );
view->Remove( &m_viewSnapLine );
}
VECTOR2I PCB_GRID_HELPER::AlignToSegment( const VECTOR2I& aPoint, const SEG& aSeg )
{
const int c_gridSnapEpsilon_sq = 4;

View File

@ -39,6 +39,7 @@ class PCB_GRID_HELPER : public GRID_HELPER
public:
PCB_GRID_HELPER( TOOL_MANAGER* aToolMgr, MAGNETIC_SETTINGS* aMagneticSettings );
~PCB_GRID_HELPER() override;
/**
* Function GetSnapped