Scale markers somewhat proportionally to zoom.

Fixes https://gitlab.com/kicad/code/kicad/issues/10048

(cherry picked from commit a1c8e36c99)
This commit is contained in:
Jeff Young 2021-12-21 15:42:10 +00:00
parent b403930601
commit e9e742816d
4 changed files with 12 additions and 1 deletions

View File

@ -64,6 +64,7 @@ public:
* The scaling factor to convert polygonal shape coordinates to internal units. * The scaling factor to convert polygonal shape coordinates to internal units.
*/ */
int MarkerScale() const { return m_scalingFactor; } int MarkerScale() const { return m_scalingFactor; }
void SetMarkerScale( int aScale ) { m_scalingFactor = aScale; }
/** /**
* Return the shape polygon in internal units in a #SHAPE_LINE_CHAIN the coordinates * Return the shape polygon in internal units in a #SHAPE_LINE_CHAIN the coordinates

View File

@ -40,7 +40,7 @@
/// Factor to convert the maker unit shape to internal units: /// Factor to convert the maker unit shape to internal units:
#define SCALING_FACTOR Millimeter2iu( 0.075 ) #define SCALING_FACTOR Millimeter2iu( 0.1625 )
@ -205,6 +205,12 @@ KIGFX::COLOR4D PCB_MARKER::getColor() const
} }
void PCB_MARKER::SetZoom( double aZoomFactor )
{
SetMarkerScale( SCALING_FACTOR * aZoomFactor );
}
const EDA_RECT PCB_MARKER::GetBoundingBox() const const EDA_RECT PCB_MARKER::GetBoundingBox() const
{ {
EDA_RECT bbox = m_shapeBoundingBox; EDA_RECT bbox = m_shapeBoundingBox;

View File

@ -97,6 +97,8 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
void SetZoom( double aZoomFactor );
const BOX2I ViewBBox() const override; const BOX2I ViewBBox() const override;
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;

View File

@ -1911,6 +1911,8 @@ void PCB_PAINTER::draw( const PCB_MARKER* aMarker, int aLayer )
return; return;
} }
const_cast<PCB_MARKER*>( aMarker )->SetZoom( 1.0 / sqrt( m_gal->GetZoomFactor() ) );
SHAPE_LINE_CHAIN polygon; SHAPE_LINE_CHAIN polygon;
aMarker->ShapeToPolygon( polygon ); aMarker->ShapeToPolygon( polygon );