diff --git a/apps/shared/interactive_curve_view_controller.cpp b/apps/shared/interactive_curve_view_controller.cpp index e97a3d9dc..9dbad9ac8 100644 --- a/apps/shared/interactive_curve_view_controller.cpp +++ b/apps/shared/interactive_curve_view_controller.cpp @@ -151,7 +151,6 @@ void InteractiveCurveViewController::viewWillAppear() { if (m_interactiveRange->zoomAuto()) { m_interactiveRange->setDefault(); - m_interactiveRange->checkForNormalizedRange(); } /* Warning: init cursor parameter before reloading banner view. Indeed, @@ -298,8 +297,6 @@ bool InteractiveCurveViewController::autoButtonAction() { m_interactiveRange->setZoomAuto(false); } else { m_interactiveRange->setDefault(); - m_interactiveRange->setZoomAuto(true); - m_interactiveRange->checkForNormalizedRange(); initCursorParameters(); setCurveViewAsMainView(); } @@ -310,9 +307,8 @@ bool InteractiveCurveViewController::normalizeButtonAction() { if (m_interactiveRange->zoomNormalize()) { m_interactiveRange->setZoomNormalize(false); } else { - m_interactiveRange->normalize(); m_interactiveRange->setZoomAuto(false); - m_interactiveRange->setZoomNormalize(true); + m_interactiveRange->normalize(); setCurveViewAsMainView(); } return m_interactiveRange->zoomNormalize(); diff --git a/apps/shared/interactive_curve_view_range.cpp b/apps/shared/interactive_curve_view_range.cpp index 20eb45544..ac3ce0b8f 100644 --- a/apps/shared/interactive_curve_view_range.cpp +++ b/apps/shared/interactive_curve_view_range.cpp @@ -102,6 +102,9 @@ void InteractiveCurveViewRange::normalize() { MemoizedCurveViewRange::protectedSetXMax(newXMax, k_lowerMaxFloat, k_upperMaxFloat); m_yRange.setMin(newYMin, k_lowerMaxFloat, k_upperMaxFloat); MemoizedCurveViewRange::protectedSetYMax(newYMax, k_lowerMaxFloat, k_upperMaxFloat); + + assert(isOrthonormal()); + setZoomNormalize(true); } void InteractiveCurveViewRange::setDefault() { @@ -126,12 +129,12 @@ void InteractiveCurveViewRange::setDefault() { m_yRange.setMin(m_delegate->addMargin(yMin(), yRange, true, true), k_lowerMaxFloat, k_upperMaxFloat); MemoizedCurveViewRange::protectedSetYMax(m_delegate->addMargin(yMax(), yRange, true, false), k_lowerMaxFloat, k_upperMaxFloat); - if (!(m_delegate->defaultRangeIsNormalized() || revertToNormalized)) { - return; + if (m_delegate->defaultRangeIsNormalized() || revertToNormalized) { + // Normalize the axes, so that a polar circle is displayed as a circle + normalize(); } - // Normalize the axes, so that a polar circle is displayed as a circle - normalize(); + setZoomAuto(true); } void InteractiveCurveViewRange::setNullRange() { @@ -201,10 +204,6 @@ void InteractiveCurveViewRange::panToMakePointVisible(float x, float y, float to } } -void InteractiveCurveViewRange::checkForNormalizedRange() { - setZoomNormalize(isOrthonormal()); -} - bool InteractiveCurveViewRange::isOrthonormal(float tolerance) const { float ratio = (yMax() - yMin()) / (xMax() - xMin()); float ratioDifference = std::fabs(std::log(ratio / NormalYXRatio())); diff --git a/apps/shared/interactive_curve_view_range.h b/apps/shared/interactive_curve_view_range.h index 4ea7b9c58..ce23d261b 100644 --- a/apps/shared/interactive_curve_view_range.h +++ b/apps/shared/interactive_curve_view_range.h @@ -47,7 +47,6 @@ public: void setNullRange(); void centerAxisAround(Axis axis, float position); void panToMakePointVisible(float x, float y, float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation, float pixelWidth); - void checkForNormalizedRange(); protected: constexpr static float k_upperMaxFloat = 1E+8f; diff --git a/apps/shared/range_parameter_controller.cpp b/apps/shared/range_parameter_controller.cpp index 3d8b6a458..2e2712ed2 100644 --- a/apps/shared/range_parameter_controller.cpp +++ b/apps/shared/range_parameter_controller.cpp @@ -86,7 +86,7 @@ int RangeParameterController::reusableParameterCellCount(int type) { void RangeParameterController::buttonAction() { *m_interactiveRange = m_tempInteractiveRange; m_interactiveRange->setZoomAuto(false); - m_interactiveRange->checkForNormalizedRange(); + m_interactiveRange->setZoomNormalize(m_interactiveRange->isOrthonormal()); StackViewController * stack = stackController(); stack->pop();