Pcbnew, pdf plotter: fixes and enhancements.
* To select a footprint info, Use the bbox with not text as selectable area * Fix also incorrect position of footprint bbox when plotting with offset Fixes https://gitlab.com/kicad/code/kicad/-/issues/17355
This commit is contained in:
parent
2af35ac4f1
commit
c0fd138706
|
@ -543,6 +543,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void EndBlock( void* aData ) {}
|
virtual void EndBlock( void* aData ) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the plot offset in IUs, set by SetViewport() and used
|
||||||
|
* to plot items.
|
||||||
|
*/
|
||||||
|
VECTOR2I GetPlotOffsetUserUnits() {return m_plotOffset; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -631,6 +637,7 @@ protected:
|
||||||
|
|
||||||
double GetDashGapLenIU( int aLineWidth ) const;
|
double GetDashGapLenIU( int aLineWidth ) const;
|
||||||
|
|
||||||
|
|
||||||
protected: // variables used in most of plotters:
|
protected: // variables used in most of plotters:
|
||||||
/// Plot scale - chosen by the user (even implicitly with 'fit in a4')
|
/// Plot scale - chosen by the user (even implicitly with 'fit in a4')
|
||||||
double m_plotScale;
|
double m_plotScale;
|
||||||
|
|
|
@ -118,9 +118,22 @@ void PlotInteractiveLayer( BOARD* aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARA
|
||||||
_( "Keywords" ),
|
_( "Keywords" ),
|
||||||
fp->GetKeywords() ) );
|
fp->GetKeywords() ) );
|
||||||
#endif
|
#endif
|
||||||
aPlotter->HyperlinkMenu( fp->GetBoundingBox(), properties );
|
// Draw items are plotted with a position offset. So we need to move
|
||||||
|
// our boxes (which are not plotted) by the same offset.
|
||||||
|
VECTOR2I offset = -aPlotter->GetPlotOffsetUserUnits();
|
||||||
|
|
||||||
aPlotter->Bookmark( fp->GetBoundingBox(), fp->GetReference(), _( "Footprints" ) );
|
// Use a footprint bbox without texts to create the hyperlink area
|
||||||
|
BOX2I bbox = fp->GetBoundingBox( false, false );
|
||||||
|
bbox.Move( offset );
|
||||||
|
aPlotter->HyperlinkMenu( bbox, properties );
|
||||||
|
|
||||||
|
// Use a footprint bbox with visible texts only to create the bookmark area
|
||||||
|
// which is the area to zoom on ft selection
|
||||||
|
// However the bbox need to be inflated for a better look.
|
||||||
|
bbox = fp->GetBoundingBox( true, false );
|
||||||
|
bbox.Move( offset );
|
||||||
|
bbox.Inflate( bbox.GetWidth() /2, bbox.GetHeight() /2 );
|
||||||
|
aPlotter->Bookmark( bbox, fp->GetReference(), _( "Footprints" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue