From 33f5483bc9dbbacb79df3034724b0a97345984a0 Mon Sep 17 00:00:00 2001 From: Josue Huaroto Date: Fri, 15 Sep 2023 17:50:02 +0000 Subject: [PATCH] Change Y min/max limits in simulation plot window --- common/widgets/mathplot.cpp | 8 +++++--- include/widgets/mathplot.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) 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,...