PNS_DRAGGER should report its layers.
Also, don't use ViewGetLayers() for visibility checking. For some things (like vias) it deals with synthetic layers, not board layers. Fixes https://gitlab.com/kicad/code/kicad/issues/6328
This commit is contained in:
parent
02334e0a62
commit
64876a2761
|
@ -79,11 +79,28 @@ public:
|
|||
*/
|
||||
NODE* CurrentNode() const override;
|
||||
|
||||
/**
|
||||
* Function CurrentNets()
|
||||
*
|
||||
* Returns the net code(s) of currently dragged item(s).
|
||||
* Currently unused for component dragging.
|
||||
*/
|
||||
const std::vector<int> CurrentNets() const override
|
||||
{
|
||||
return std::vector<int>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function CurrentLayer()
|
||||
*
|
||||
* Returns the layer of currently dragged item(s).
|
||||
* Currently unused for component dragging.
|
||||
*/
|
||||
virtual int CurrentLayer() const override
|
||||
{
|
||||
return UNDEFINED_LAYER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Traces()
|
||||
*
|
||||
|
|
|
@ -95,8 +95,20 @@ public:
|
|||
*/
|
||||
virtual NODE* CurrentNode() const = 0;
|
||||
|
||||
/**
|
||||
* Function CurrentNets()
|
||||
*
|
||||
* Returns the net code(s) of currently dragged item(s).
|
||||
*/
|
||||
virtual const std::vector<int> CurrentNets() const = 0;
|
||||
|
||||
/**
|
||||
* Function CurrentLayer()
|
||||
*
|
||||
* Returns the layer of currently dragged item(s).
|
||||
*/
|
||||
virtual int CurrentLayer() const = 0;
|
||||
|
||||
/**
|
||||
* Function Traces()
|
||||
*
|
||||
|
|
|
@ -83,11 +83,26 @@ public:
|
|||
*/
|
||||
NODE* CurrentNode() const override;
|
||||
|
||||
/**
|
||||
* Function CurrentNets()
|
||||
*
|
||||
* Returns the net code(s) of currently routed track(s).
|
||||
*/
|
||||
const std::vector<int> CurrentNets() const override
|
||||
{
|
||||
return std::vector<int>( 1, m_draggedLine.Net() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function CurrentLayer()
|
||||
*
|
||||
* Returns the layer of currently routed track.
|
||||
*/
|
||||
int CurrentLayer() const override
|
||||
{
|
||||
return m_draggedLine.Layer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Traces()
|
||||
*
|
||||
|
|
|
@ -1129,32 +1129,18 @@ bool PNS_KICAD_IFACE::IsItemVisible( const PNS::ITEM* aItem ) const
|
|||
if( !m_view || !aItem->Parent() )
|
||||
return true;
|
||||
|
||||
BOARD_ITEM* item = aItem->Parent();
|
||||
bool isOnVisibleLayer = true;
|
||||
BOARD_ITEM* item = aItem->Parent();
|
||||
bool isOnVisibleLayer = true;
|
||||
RENDER_SETTINGS* settings = m_view->GetPainter()->GetSettings();
|
||||
|
||||
if( m_view->GetPainter()->GetSettings()->GetHighContrast() )
|
||||
{
|
||||
int layers[KIGFX::VIEW::VIEW_MAX_LAYERS];
|
||||
int layers_count;
|
||||
auto activeLayers = m_view->GetPainter()->GetSettings()->GetHighContrastLayers();
|
||||
|
||||
isOnVisibleLayer = false;
|
||||
item->ViewGetLayers( layers, layers_count );
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
{
|
||||
// Item is on at least one of the active layers
|
||||
if( activeLayers.count( layers[i] ) > 0 )
|
||||
{
|
||||
isOnVisibleLayer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( settings->GetHighContrast() )
|
||||
isOnVisibleLayer = item->IsOnLayer( settings->GetPrimaryHighContrastLayer() );
|
||||
|
||||
if( m_view->IsVisible( item ) && isOnVisibleLayer
|
||||
&& item->ViewGetLOD( item->GetLayer(), m_view ) < m_view->GetScale() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Items hidden in the router are not hidden on the board
|
||||
if( m_hiddenItems.find( item ) != m_hiddenItems.end() )
|
||||
|
|
|
@ -521,6 +521,9 @@ int ROUTER::GetCurrentLayer() const
|
|||
{
|
||||
if( m_placer )
|
||||
return m_placer->CurrentLayer();
|
||||
else if( m_dragger )
|
||||
return m_dragger->CurrentLayer();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue