From f907b58d17a8729545efbfa9ab02ea4ede0bef0d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 31 May 2024 13:48:44 +0100 Subject: [PATCH] Handle DPI-change for footprint 3D-previews in Footprint Chooser. --- pcbnew/dialogs/dialog_footprint_chooser.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pcbnew/dialogs/dialog_footprint_chooser.cpp b/pcbnew/dialogs/dialog_footprint_chooser.cpp index 05793b3aba..7833770218 100644 --- a/pcbnew/dialogs/dialog_footprint_chooser.cpp +++ b/pcbnew/dialogs/dialog_footprint_chooser.cpp @@ -135,6 +135,20 @@ DIALOG_FOOTPRINT_CHOOSER::DIALOG_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aParent, wxCommandEventHandler( DIALOG_FOOTPRINT_CHOOSER::onFpViewReq ), nullptr, this ); + Bind( wxEVT_MOVE, + [this]( wxMoveEvent& aEvent ) + { + COMMON_SETTINGS* settings = Pgm().GetCommonSettings(); + const DPI_SCALING_COMMON dpi( settings, this ); + + if( m_preview3DCanvas->GetScaleFactor() != dpi.GetScaleFactor() ) + { + m_preview3DCanvas->SetScaleFactor( dpi.GetScaleFactor() ); + m_preview3DCanvas->ReloadRequest(); + m_preview3DCanvas->Refresh(); + } + } ); + Connect( FP_SELECTION_EVENT, wxCommandEventHandler( DIALOG_FOOTPRINT_CHOOSER::onFpChanged ), nullptr, this ); }