From c5fe265eb40f2a17f0536707371df02c772f48f8 Mon Sep 17 00:00:00 2001 From: Kliment Date: Sat, 19 Nov 2022 17:25:27 +0100 Subject: [PATCH] Take axis inversion into account when importing graphics. Fixes #9351. --- pcbnew/import_gfx/dialog_import_gfx.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pcbnew/import_gfx/dialog_import_gfx.cpp b/pcbnew/import_gfx/dialog_import_gfx.cpp index ec6552a985..6043421df1 100644 --- a/pcbnew/import_gfx/dialog_import_gfx.cpp +++ b/pcbnew/import_gfx/dialog_import_gfx.cpp @@ -214,9 +214,23 @@ bool DIALOG_IMPORT_GFX::TransferDataFromWindow() return false; } + PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings(); wxString ext = wxFileName( m_textCtrlFileName->GetValue() ).GetExt(); double scale = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_importScaleCtrl->GetValue() ); - VECTOR2D origin( m_xOrigin.GetValue() / scale, m_yOrigin.GetValue() / scale ); + double xscale = scale; + double yscale = scale; + + if( cfg->m_Display.m_DisplayInvertXAxis ) + { + xscale *= -1.0; + } + + if( cfg->m_Display.m_DisplayInvertYAxis ) + { + yscale *= -1.0; + } + + VECTOR2D origin( m_xOrigin.GetValue() / xscale, m_yOrigin.GetValue() / yscale ); if( std::unique_ptr plugin = m_gfxImportMgr->GetPluginByExt( ext ) ) {