[apps/shared] Clip displayed range in graph view in interactive curve

view range

Change-Id: I4654a1f9c06420d6ade8a86a13c0d89f025f324f
This commit is contained in:
Émilie Feral
2017-03-17 16:42:44 +01:00
parent eb4a217e0d
commit dc6acc0d48
19 changed files with 105 additions and 41 deletions

View File

@@ -44,22 +44,32 @@ float GoToParameterController::parameterAtIndex(int index) {
return m_cursor->y();
}
void GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
bool GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
assert(parameterIndex == 0);
if (fabsf(f) > k_maxDisplayableFloat) {
app()->displayWarning(I18n::Message::ForbiddenValue);
return false;
}
if (m_xPrediction) {
float y = m_store->yValueForXValue(f);
if (fabsf(y) > k_maxDisplayableFloat) {
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);
if (isnan(x)) {
return;
if (fabsf(x) > k_maxDisplayableFloat) {
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;
}
HighlightCell * GoToParameterController::reusableParameterCell(int index, int type) {