Make sure aliases get their refs and values drawn correctly.
Fixes: lp:1799460 * https://bugs.launchpad.net/kicad/+bug/1799460
This commit is contained in:
parent
a96dbde738
commit
0c06bdb1e0
|
@ -182,9 +182,15 @@ bool operator<( const LIB_ALIAS& aItem1, const LIB_ALIAS& aItem2 )
|
||||||
|
|
||||||
void LIB_ALIAS::ViewGetLayers( int aLayers[], int& aCount ) const
|
void LIB_ALIAS::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
{
|
{
|
||||||
aCount = 2;
|
// An alias's fields don't know how to fetch their parent's values so we don't let
|
||||||
|
// them draw themselves. This means the alias always has to draw them, which means
|
||||||
|
// it has to "own" their layers as well.
|
||||||
|
aCount = 5;
|
||||||
aLayers[0] = LAYER_DEVICE;
|
aLayers[0] = LAYER_DEVICE;
|
||||||
aLayers[1] = LAYER_DEVICE_BACKGROUND;
|
aLayers[1] = LAYER_DEVICE_BACKGROUND;
|
||||||
|
aLayers[2] = LAYER_REFERENCEPART;
|
||||||
|
aLayers[3] = LAYER_VALUEPART;
|
||||||
|
aLayers[4] = LAYER_FIELDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -108,8 +108,9 @@ void SCH_PREVIEW_PANEL::setDefaultLayerOrder()
|
||||||
|
|
||||||
void SCH_PREVIEW_PANEL::setDefaultLayerDeps()
|
void SCH_PREVIEW_PANEL::setDefaultLayerDeps()
|
||||||
{
|
{
|
||||||
// caching makes no sense for Cairo and other software renderers
|
// An alias's fields don't know how to substitute in their parent's values, so we
|
||||||
auto target = m_backend == GAL_TYPE_OPENGL ? KIGFX::TARGET_CACHED : KIGFX::TARGET_NONCACHED;
|
// don't let them draw themselves. This means no caching.
|
||||||
|
auto target = KIGFX::TARGET_NONCACHED;
|
||||||
|
|
||||||
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
|
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
|
||||||
m_view->SetLayerTarget( i, target );
|
m_view->SetLayerTarget( i, target );
|
||||||
|
|
|
@ -82,18 +82,8 @@ void SCH_VIEW::DisplayComponent( LIB_PART *aPart )
|
||||||
if( !aPart )
|
if( !aPart )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int fgPriority = INT_MAX / 2;
|
|
||||||
int bgPriority = 0;
|
|
||||||
|
|
||||||
for ( auto &item : aPart->GetDrawItems() )
|
for ( auto &item : aPart->GetDrawItems() )
|
||||||
{
|
Add( &item );
|
||||||
// Apply a z-order heuristic (because we don't yet let the user edit it):
|
|
||||||
// push body-filled objects to the back.
|
|
||||||
if( item.GetFillMode() == FILLED_WITH_BG_BODYCOLOR )
|
|
||||||
Add( &item, bgPriority++ );
|
|
||||||
else
|
|
||||||
Add( &item, fgPriority++ );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_selectionArea.reset( new KIGFX::PREVIEW::SELECTION_AREA( ) );
|
m_selectionArea.reset( new KIGFX::PREVIEW::SELECTION_AREA( ) );
|
||||||
m_preview.reset( new KIGFX::VIEW_GROUP () );
|
m_preview.reset( new KIGFX::VIEW_GROUP () );
|
||||||
|
|
Loading…
Reference in New Issue