3D view export to PNG/JPEG: ensure highlighted item under cursor is exoperted

not highlighted.
Fixes #14289
https://gitlab.com/kicad/code/kicad/-/issues/14289
This commit is contained in:
jean-pierre charras 2024-02-19 16:28:38 +01:00
parent 60fe87a73c
commit 9622918c31
2 changed files with 13 additions and 8 deletions

View File

@ -208,12 +208,6 @@ public:
m_3dmousePivotPos = aPos;
}
private:
/**
* Called by a wxPaintEvent event
*/
void OnPaint( wxPaintEvent& aEvent );
/**
* The actual function to repaint the canvas.
*
@ -222,6 +216,10 @@ private:
*/
void DoRePaint();
private:
// The wxPaintEvent event. mainly calls DoRePaint()
void OnPaint( wxPaintEvent& aEvent );
void OnEraseBackground( wxEraseEvent& event );
void OnRefreshRequest( wxEvent& aEvent );

View File

@ -757,8 +757,13 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
}
// Be sure we have the latest 3D view (remember 3D view is buffered)
m_canvas->Request_refresh( true );
wxYield();
// Also ensure any highlighted item is not highlighted when creating screen shot
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
bool allow_highlight = cfg.highlight_on_rollover;
cfg.highlight_on_rollover = false;
m_canvas->DoRePaint(); // init first buffer
m_canvas->DoRePaint(); // init second buffer
// Build image from the 3D buffer
wxWindowUpdateLocker noUpdates( this );
@ -768,6 +773,8 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
if( m_canvas )
m_canvas->GetScreenshot( screenshotImage );
cfg.highlight_on_rollover = allow_highlight;
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
{
wxBitmap bitmap( screenshotImage );