Legacy canvas: fix issue when zooming in/out using mousewheel: slightly shifts screen up/down.
It happens only when the 'warp and center cursor on zoom' option is disabled. Was created after modifying the code in EDA_DRAW_FRAME::AdjustScrollBars(), making EDA_DRAW_FRAME::RedrawScreen2() not working very well. (partial fix of bug 1562173)
This commit is contained in:
parent
f6f726acab
commit
f52763f22b
|
@ -990,6 +990,8 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
|||
// Full drawing or "page" rectangle in internal units
|
||||
DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
|
||||
|
||||
// Remark: if something is modified here, perhaps EDA_DRAW_FRAME::RedrawScreen2()
|
||||
// will need changes accordint to the way the center is computed
|
||||
// Account for scrollbars
|
||||
wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
|
||||
wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
|
||||
|
|
|
@ -64,8 +64,12 @@ void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore )
|
|||
if( IsGalCanvasActive() )
|
||||
return;
|
||||
|
||||
// relative screen position to center before zoom
|
||||
wxPoint dPos = posBefore - m_canvas->GetClientSize() / 2;
|
||||
// Account for scrollbars (see EDA_DRAW_FRAME::AdjustScrollBars that takes
|
||||
// in account scroolbars area to adjust scroll bars)
|
||||
wxSize scrollbarSize = m_canvas->GetSize() - m_canvas->GetClientSize();
|
||||
wxSize sizeAdjusted = m_canvas->GetClientSize() - scrollbarSize;
|
||||
|
||||
wxPoint dPos = posBefore - sizeAdjusted / 2;
|
||||
|
||||
// screen position of crosshair after zoom
|
||||
wxPoint newScreenPos = m_canvas->ToDeviceXY( GetCrossHairPosition() );
|
||||
|
|
Loading…
Reference in New Issue