[apps/shared] Fix bug in go to parameter controllers

Change-Id: I196378c4921583af42dc4a2e64e3a6c32038f9d1
This commit is contained in:
Émilie Feral
2017-03-29 16:30:37 +02:00
parent ffd6e61328
commit e95ea50d3c
5 changed files with 12 additions and 11 deletions

View File

@@ -56,8 +56,6 @@ bool GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
app()->displayWarning(I18n::Message::ForbiddenValue);
return false;
}
m_store->centerAxisAround(CurveViewRange::Axis::X, f);
m_store->centerAxisAround(CurveViewRange::Axis::Y, y);
m_cursor->moveTo(f, y);
} else {
float x = m_store->xValueForYValue(f);
@@ -65,8 +63,6 @@ bool GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
app()->displayWarning(I18n::Message::ForbiddenValue);
return false;
}
m_store->centerAxisAround(CurveViewRange::Axis::X, x);
m_store->centerAxisAround(CurveViewRange::Axis::Y, f);
m_cursor->moveTo(x, f);
}
return true;
@@ -114,6 +110,8 @@ void GoToParameterController::viewWillAppear() {
}
void GoToParameterController::buttonAction() {
m_store->centerAxisAround(CurveViewRange::Axis::X, m_cursor->x());
m_store->centerAxisAround(CurveViewRange::Axis::Y, m_cursor->y());
StackViewController * stack = (StackViewController *)parentResponder();
stack->pop();
stack->pop();

View File

@@ -44,8 +44,6 @@ bool GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
app()->displayWarning(I18n::Message::ForbiddenValue);
return false;
}
m_graphRange->centerAxisAround(CurveViewRange::Axis::X, f);
m_graphRange->centerAxisAround(CurveViewRange::Axis::Y, y);
m_cursor->moveTo(f, y);
return true;
}
@@ -64,6 +62,8 @@ void GoToParameterController::setFunction(Function * function) {
}
void GoToParameterController::buttonAction() {
m_graphRange->centerAxisAround(CurveViewRange::Axis::X, m_cursor->x());
m_graphRange->centerAxisAround(CurveViewRange::Axis::Y, m_cursor->y());
StackViewController * stack = (StackViewController *)parentResponder();
stack->pop();
stack->pop();

View File

@@ -137,15 +137,13 @@ void InteractiveCurveViewController::viewWillAppear() {
* reloading banner view needs an updated cursor to load the right data. */
initCursorParameters();
centerCursorVertically();
reloadBannerView();
curveView()->reload();
}
uint32_t newRangeVersion = rangeVersion();
if (m_rangeVersion != newRangeVersion) {
m_rangeVersion = newRangeVersion;
initCursorParameters();
reloadBannerView();
curveView()->reload();
if (!interactiveCurveViewRange()->isCursorVisible()) {
initCursorParameters();
}
}
curveView()->selectMainView(true);
header()->setSelectedButton(-1);

View File

@@ -201,6 +201,10 @@ void InteractiveCurveViewRange::panToMakePointVisible(float x, float y, float to
}
}
bool InteractiveCurveViewRange::isCursorVisible() {
return m_cursor->x() >= m_xMin && m_cursor->x() <= m_xMax && m_cursor->y() >= m_yMin && m_cursor->y() <= m_yMax;
}
float InteractiveCurveViewRange::clipped(float x, bool isMax) {
float max = isMax ? k_upperMaxFloat : k_lowerMaxFloat;
float min = isMax ? -k_lowerMaxFloat : -k_upperMaxFloat;

View File

@@ -31,6 +31,7 @@ public:
virtual void setDefault();
void centerAxisAround(Axis axis, float position);
void panToMakePointVisible(float x, float y, float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation);
bool isCursorVisible();
protected:
bool m_yAuto;
InteractiveCurveViewRangeDelegate * m_delegate;