mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 00:21:36 +00:00
Printing is not zoom-specific.
(Some of these items don't currently get printed, but there's no sense in leaving a latent bug around in case we ever change our minds.)
This commit is contained in:
parent
ce5469b95e
commit
877c6bce89
common/view
eeschema
gerbview
include/view
pcbnew
@ -25,6 +25,7 @@
|
||||
|
||||
#include <view/view_item.h>
|
||||
#include <view/view.h>
|
||||
#include <gal/painter.h>
|
||||
|
||||
using namespace KIGFX;
|
||||
|
||||
@ -33,3 +34,15 @@ VIEW_ITEM::~VIEW_ITEM()
|
||||
VIEW::OnDestroy( this );
|
||||
m_viewPrivData = nullptr;
|
||||
}
|
||||
|
||||
|
||||
double VIEW_ITEM::lodScaleForThreshold( const VIEW* aView, int aWhatIu, int aThresholdIu )
|
||||
{
|
||||
if( aView->GetPainter()->GetSettings()->IsPrinting() )
|
||||
return LOD_SHOW;
|
||||
|
||||
if( aWhatIu == 0 )
|
||||
return LOD_HIDE;
|
||||
|
||||
return double( aThresholdIu ) / aWhatIu;
|
||||
}
|
||||
|
@ -207,10 +207,10 @@ double SCH_LINE::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
|
||||
// Operating points will be shown only if zoom is appropriate
|
||||
if( height > 0 )
|
||||
return lodScaleForThreshold( height, schIUScale.mmToIU( 5 ) );
|
||||
return lodScaleForThreshold( aView, height, schIUScale.mmToIU( 5 ) );
|
||||
|
||||
const int width = std::abs( m_end.x - m_start.x );
|
||||
return lodScaleForThreshold( width, schIUScale.mmToIU( 15 ) );
|
||||
return lodScaleForThreshold( aView, width, schIUScale.mmToIU( 15 ) );
|
||||
}
|
||||
|
||||
// Other layers are always drawn.
|
||||
|
@ -1005,7 +1005,7 @@ double GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) cons
|
||||
|
||||
// the level of details is chosen experimentally, to show
|
||||
// only a readable text:
|
||||
return lodScaleForThreshold( size, gerbIUScale.mmToIU( 3.0 ) );
|
||||
return lodScaleForThreshold( aView, size, gerbIUScale.mmToIU( 3.0 ) );
|
||||
}
|
||||
|
||||
// Other layers are shown without any conditions
|
||||
|
@ -193,13 +193,7 @@ protected:
|
||||
* Because even at zoom 1.0, 1mm in KiCad may not be exactly 1mm on a physical
|
||||
* screen, the threshold may not be exact in practice.
|
||||
*/
|
||||
static constexpr double lodScaleForThreshold( int aWhatIu, int aThresholdIu )
|
||||
{
|
||||
if( aWhatIu == 0 )
|
||||
return LOD_HIDE;
|
||||
|
||||
return double( aThresholdIu ) / aWhatIu;
|
||||
}
|
||||
static double lodScaleForThreshold( const KIGFX::VIEW* aView, int aWhatIu, int aThresholdIu );
|
||||
|
||||
private:
|
||||
friend class VIEW;
|
||||
|
@ -1783,23 +1783,20 @@ double PAD::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
// Netnames will be shown only if zoom is appropriate
|
||||
const int minSize = std::min( GetBoundingBox().GetWidth(), GetBoundingBox().GetHeight() );
|
||||
|
||||
return lodScaleForThreshold( minSize, pcbIUScale.mmToIU( 0.5 ) );
|
||||
return lodScaleForThreshold( aView, minSize, pcbIUScale.mmToIU( 0.5 ) );
|
||||
}
|
||||
|
||||
// Hole walls always need a repaint when zoom changes
|
||||
if( aLayer == LAYER_PAD_HOLEWALLS )
|
||||
aView->Update( this, KIGFX::REPAINT );
|
||||
|
||||
if( renderSettings.IsPrinting() )
|
||||
return LOD_SHOW;
|
||||
|
||||
VECTOR2L padSize = GetShape( pcbLayer ) != PAD_SHAPE::CUSTOM
|
||||
? VECTOR2L( GetSize( pcbLayer ) ) : GetBoundingBox().GetSize();
|
||||
|
||||
int64_t minSide = std::min( padSize.x, padSize.y );
|
||||
|
||||
if( minSide > 0 )
|
||||
return std::min( (double) pcbIUScale.mmToIU( 0.2 ) / minSide, 3.5 );
|
||||
return std::min( lodScaleForThreshold( aView, minSide, pcbIUScale.mmToIU( 0.2 ) ), 3.5 );
|
||||
|
||||
return LOD_SHOW;
|
||||
}
|
||||
|
@ -1535,7 +1535,7 @@ double PCB_TRACK::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
return LOD_HIDE;
|
||||
|
||||
// Netnames will be shown only if zoom is appropriate
|
||||
return lodScaleForThreshold( m_width, pcbIUScale.mmToIU( 4.0 ) );
|
||||
return lodScaleForThreshold( aView, m_width, pcbIUScale.mmToIU( 4.0 ) );
|
||||
}
|
||||
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||
|
Loading…
Reference in New Issue
Block a user