diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index f0160759e6..9c0f14dde2 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -1715,8 +1715,8 @@ void mpWindow::AdjustLimitedView() // xMin, xMax, yMin, yMax are the full limits (plot limit + margin) const double xMin = m_minX - m_marginLeft / m_scaleX; const double xMax = m_maxX + m_marginRight / m_scaleX; - const double yMin = m_minY - m_marginTop / m_scaleY; - const double yMax = m_maxY + m_marginBottom / m_scaleY; + const double yMin = m_minY - m_marginBottom / m_scaleY; + const double yMax = m_maxY + m_marginTop / m_scaleY; if( m_desiredXmin < xMin ) { @@ -1872,7 +1872,9 @@ void mpWindow::ZoomOut( const wxPoint& centerPoint, double zoomFactor ) m_desiredXmax = m_posX + (m_scrX - m_marginLeft - m_marginRight) / m_scaleX; m_desiredYmax = m_posY; m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; - + + AdjustLimitedView(); + if( !CheckXLimits( m_desiredXmax, m_desiredXmin ) || !CheckYLimits( m_desiredYmax, m_desiredYmin ) ) { diff --git a/include/widgets/mathplot.h b/include/widgets/mathplot.h index caa7523e2a..639da71e07 100644 --- a/include/widgets/mathplot.h +++ b/include/widgets/mathplot.h @@ -1259,8 +1259,8 @@ protected: bool CheckYLimits( double& desiredMax, double& desiredMin ) const { return !( m_enableLimitedView - && (desiredMax > m_maxY + m_marginBottom / m_scaleY - || desiredMin < m_minY + m_marginTop / m_scaleY) ); + && (desiredMax > m_maxY + m_marginTop / m_scaleY + || desiredMin < m_minY - m_marginBottom / m_scaleY) ); } /** Recalculate global layer bounding box, and save it in m_minX,...