diff --git a/apps/graph/graph/graph_controller.cpp b/apps/graph/graph/graph_controller.cpp index 74873a1c3..832a201f4 100644 --- a/apps/graph/graph/graph_controller.cpp +++ b/apps/graph/graph/graph_controller.cpp @@ -169,4 +169,8 @@ bool GraphController::displaysNonCartesianFunctions() const { || store->numberOfActiveFunctionsOfType(CartesianFunction::PlotType::Parametric) > 0; } +bool GraphController::shouldSetDefaultOnModelChange() const { + return displaysNonCartesianFunctions(); +} + } diff --git a/apps/graph/graph/graph_controller.h b/apps/graph/graph/graph_controller.h index 21fe08b0d..5ca2348cf 100644 --- a/apps/graph/graph/graph_controller.h +++ b/apps/graph/graph/graph_controller.h @@ -37,6 +37,7 @@ private: bool displaysNonCartesianFunctions() const; bool defautRangeIsNormalized() const override { return displaysNonCartesianFunctions(); } void interestingFunctionRange(Shared::ExpiringPointer f, float tMin, float tMax, float step, float * xm, float * xM, float * ym, float * yM) const; + bool shouldSetDefaultOnModelChange() const override; Shared::RoundCursorView m_cursorView; BannerView m_bannerView; diff --git a/apps/shared/interactive_curve_view_controller.cpp b/apps/shared/interactive_curve_view_controller.cpp index f8ff1f800..aa3a0e31c 100644 --- a/apps/shared/interactive_curve_view_controller.cpp +++ b/apps/shared/interactive_curve_view_controller.cpp @@ -144,7 +144,7 @@ Responder * InteractiveCurveViewController::defaultController() { void InteractiveCurveViewController::viewWillAppear() { uint32_t newModelVersion = modelVersion(); if (*m_modelVersion != newModelVersion) { - if (*m_modelVersion == 0 || numberOfCurves() == 1) { + if (*m_modelVersion == 0 || numberOfCurves() == 1 || shouldSetDefaultOnModelChange()) { interactiveCurveViewRange()->setDefault(); } *m_modelVersion = newModelVersion; diff --git a/apps/shared/interactive_curve_view_controller.h b/apps/shared/interactive_curve_view_controller.h index 71350b257..d4c3d9354 100644 --- a/apps/shared/interactive_curve_view_controller.h +++ b/apps/shared/interactive_curve_view_controller.h @@ -64,6 +64,7 @@ private: // InteractiveCurveViewRangeDelegate float addMargin(float x, float range, bool isVertical, bool isMin) override; + virtual bool shouldSetDefaultOnModelChange() const { return false; } uint32_t * m_modelVersion; uint32_t * m_rangeVersion; RangeParameterController m_rangeParameterController;