diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp index cfd3db0efc..8c630adce2 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp @@ -194,6 +194,14 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() ); } + Bind( wxEVT_DPI_CHANGED, + [&]( wxDPIChangedEvent& aEvt ) + { + const DPI_SCALING_COMMON dpi{ Pgm().GetCommonSettings(), this }; + m_canvas->SetScaleFactor( dpi.GetScaleFactor() ); + aEvt.Skip(); + } ); + // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus // in order to receive mouse events. Otherwise, the user has to click somewhere on // the canvas before it will respond to mouse wheel events. diff --git a/3d-viewer/dialogs/panel_preview_3d_model.cpp b/3d-viewer/dialogs/panel_preview_3d_model.cpp index 707778cae2..497960e9aa 100644 --- a/3d-viewer/dialogs/panel_preview_3d_model.cpp +++ b/3d-viewer/dialogs/panel_preview_3d_model.cpp @@ -163,6 +163,14 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM aFrame->Connect( EDA_EVT_UNITS_CHANGED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ), nullptr, this ); + + Bind( wxEVT_DPI_CHANGED, + [&]( wxDPIChangedEvent& aEvt ) + { + const DPI_SCALING_COMMON dpi{ Pgm().GetCommonSettings(), this }; + m_previewPane->SetScaleFactor( dpi.GetScaleFactor() ); + aEvt.Skip(); + } ); } diff --git a/pcbnew/dialogs/dialog_footprint_chooser.cpp b/pcbnew/dialogs/dialog_footprint_chooser.cpp index 05793b3aba..ac82715729 100644 --- a/pcbnew/dialogs/dialog_footprint_chooser.cpp +++ b/pcbnew/dialogs/dialog_footprint_chooser.cpp @@ -137,6 +137,14 @@ DIALOG_FOOTPRINT_CHOOSER::DIALOG_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aParent, Connect( FP_SELECTION_EVENT, wxCommandEventHandler( DIALOG_FOOTPRINT_CHOOSER::onFpChanged ), nullptr, this ); + + Bind( wxEVT_DPI_CHANGED, + [&]( wxDPIChangedEvent& aEvt ) + { + const DPI_SCALING_COMMON dpi{ Pgm().GetCommonSettings(), this }; + m_preview3DCanvas->SetScaleFactor( dpi.GetScaleFactor() ); + aEvt.Skip(); + } ); } diff --git a/pcbnew/footprint_chooser_frame.cpp b/pcbnew/footprint_chooser_frame.cpp index f3122e98e7..5980961ed4 100644 --- a/pcbnew/footprint_chooser_frame.cpp +++ b/pcbnew/footprint_chooser_frame.cpp @@ -191,6 +191,14 @@ FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aPare Connect( FP_SELECTION_EVENT, // custom event fired by a PANEL_FOOTPRINT_CHOOSER wxCommandEventHandler( FOOTPRINT_CHOOSER_FRAME::onFpChanged ), nullptr, this ); + Bind( wxEVT_DPI_CHANGED, + [&]( wxDPIChangedEvent& aEvt ) + { + const DPI_SCALING_COMMON dpi{ Pgm().GetCommonSettings(), this }; + m_preview3DCanvas->SetScaleFactor( dpi.GetScaleFactor() ); + aEvt.Skip(); + } ); + // Needed on Linux to fix the position of widgets in bottomPanel PostSizeEvent(); }