[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

@@ -36,13 +36,18 @@ float GoToParameterController::parameterAtIndex(int index) {
return m_cursor->x();
}
void GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
bool GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
assert(parameterIndex == 0);
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
float y = m_function->evaluateAtAbscissa(f, myApp->localContext());
if (fabsf(f) > k_maxDisplayableFloat || fabsf(y) > k_maxDisplayableFloat) {
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;
}
HighlightCell * GoToParameterController::reusableParameterCell(int index, int type) {