mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 09:29:50 +00:00
Respect DXF origin on graphics import if possible
We only need to adjust the DXF import box location if the graphics imported do not fit on our drawing area Fixes https://gitlab.com/kicad/code/kicad/-/issues/18523
This commit is contained in:
parent
becbf82390
commit
d7f89c6576
@ -128,16 +128,19 @@ void GRAPHICS_IMPORTER_BUFFER::ImportTo( GRAPHICS_IMPORTER& aImporter )
|
||||
// in the KiCad drawing area
|
||||
else if( aImporter.GetImportOffsetMM() == VECTOR2D( 0, 0 ) )
|
||||
{
|
||||
VECTOR2D offset = boundingBox.GetOrigin();
|
||||
aImporter.SetImportOffsetMM( -offset );
|
||||
if( boundingBox.GetRight() > std::numeric_limits<int>::max()
|
||||
|| boundingBox.GetBottom() > std::numeric_limits<int>::max()
|
||||
|| boundingBox.GetLeft() < std::numeric_limits<int>::min()
|
||||
|| boundingBox.GetTop() < std::numeric_limits<int>::min() )
|
||||
{
|
||||
VECTOR2D offset = boundingBox.GetOrigin();
|
||||
aImporter.SetImportOffsetMM( -offset );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VECTOR2D bbox_origin = boundingBox.GetOrigin();
|
||||
aImporter.SetImportOffsetMM( -bbox_origin + aImporter.GetImportOffsetMM() );
|
||||
|
||||
double total_scale_x = aImporter.GetScale().x * aImporter.GetMillimeterToIuFactor();
|
||||
double total_scale_y = aImporter.GetScale().y * aImporter.GetMillimeterToIuFactor();
|
||||
double total_scale_x = aImporter.GetScale().x * aImporter.GetMillimeterToIuFactor();
|
||||
double total_scale_y = aImporter.GetScale().y * aImporter.GetMillimeterToIuFactor();
|
||||
|
||||
double max_offset_x =
|
||||
( aImporter.GetImportOffsetMM().x + boundingBox.GetRight() ) * total_scale_x;
|
||||
|
Loading…
Reference in New Issue
Block a user