From 2827594616105e298a61b1102313a055b8723e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 29 Aug 2019 15:17:38 +0200 Subject: [PATCH] [apps/shared] CartesianFunction: fix tmin and tmax default values depending on the plot type --- apps/shared/cartesian_function.cpp | 4 ++++ apps/shared/cartesian_function.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/shared/cartesian_function.cpp b/apps/shared/cartesian_function.cpp index c5fd33fb9..1e6245318 100644 --- a/apps/shared/cartesian_function.cpp +++ b/apps/shared/cartesian_function.cpp @@ -109,6 +109,10 @@ CartesianFunction::PlotType CartesianFunction::plotType() const { void CartesianFunction::setPlotType(PlotType plotType) { /* Reset memoized layout. */ m_model.tidy(); + double tMin = plotType == PlotType::Cartesian ? -INFINITY : 0.0; + double tMax = plotType == PlotType::Cartesian ? INFINITY : 360.0; + setTMin(tMin); + setTMax(tMax); return recordData()->setPlotType(plotType); } diff --git a/apps/shared/cartesian_function.h b/apps/shared/cartesian_function.h index 2565dcd6c..92bdfbd16 100644 --- a/apps/shared/cartesian_function.h +++ b/apps/shared/cartesian_function.h @@ -58,8 +58,8 @@ private: FunctionRecordDataBuffer(color), m_plotType(PlotType::Cartesian), m_displayDerivative(false), - m_tMin(0.0), - m_tMax(396.0) // TODO LEA RUBEN + m_tMin(-INFINITY), + m_tMax(INFINITY) {} PlotType plotType() const { return m_plotType; } void setPlotType(PlotType plotType) { m_plotType = plotType; }