mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 14:20:39 +01:00
[apps/shared] Change Zoom API
Moved some code around to decrease redundancy and put more of the logic into Poincare::Zoom Change-Id: I4804cf39493ac7f2f0b3c4eb554e5c15c3cef1c9
This commit is contained in:
committed by
Émilie Feral
parent
8572f4953c
commit
6be5e7d62c
@@ -46,35 +46,6 @@ float GraphController::interestingXMin() const {
|
||||
return nmin;
|
||||
}
|
||||
|
||||
void GraphController::interestingRanges(InteractiveCurveViewRange * range) const {
|
||||
int nmin = INT_MAX;
|
||||
int nmax = 0;
|
||||
int nbOfActiveModels = functionStore()->numberOfActiveFunctions();
|
||||
for (int i = 0; i < nbOfActiveModels; i++) {
|
||||
Shared::Sequence * s = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i));
|
||||
int firstInterestingIndex = s->initialRank();
|
||||
nmin = std::min(nmin, firstInterestingIndex);
|
||||
nmax = std::max(nmax, firstInterestingIndex + static_cast<int>(k_defaultXHalfRange));
|
||||
}
|
||||
assert(nmax - nmin >= k_defaultXHalfRange);
|
||||
|
||||
range->setXMin(nmin);
|
||||
range->setXMax(nmax);
|
||||
|
||||
Context * context = textFieldDelegateApp()->localContext();
|
||||
float yMin = FLT_MAX, yMax = -FLT_MAX;
|
||||
for (int i = 0; i < nbOfActiveModels; i++) {
|
||||
Shared::Sequence * s = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i));
|
||||
Zoom::ValueAtAbscissa evaluation = [](float x, Context * context, const void * auxiliary) {
|
||||
return static_cast<const Shared::Sequence *>(auxiliary)->evaluateXYAtParameter(x, context).x2();
|
||||
};
|
||||
Zoom::RefinedYRangeForDisplay(evaluation, nmin, nmax, &yMin, &yMax, context, s);
|
||||
}
|
||||
|
||||
range->setYMin(yMin);
|
||||
range->setYMax(yMax);
|
||||
}
|
||||
|
||||
bool GraphController::textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) {
|
||||
Shared::TextFieldDelegateApp * myApp = textFieldDelegateApp();
|
||||
double floatBody;
|
||||
|
||||
Reference in New Issue
Block a user