mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare/zoom] Factor range sanitation
Checking wether the range that has been computed is suitable is now done in Poincare::Zoom by SanitizeRange. Change-Id: Ib7ff73a3beae29996b1a773744021ad85c6ba946
This commit is contained in:
committed by
Émilie Feral
parent
b10be2c60c
commit
c4cd3ecffa
@@ -160,14 +160,12 @@ void FunctionGraphController::interestingRanges(InteractiveCurveViewRange * rang
|
||||
float xMin, xMax, yMin, yMax;
|
||||
Poincare::Zoom::CombineRanges(length, xMins, xMaxs, &xMin, &xMax);
|
||||
Poincare::Zoom::CombineRanges(length, yMins, yMaxs, &yMin, &yMax);
|
||||
if (std::isfinite(xMin) && std::isfinite(xMax) && std::isfinite(yMin) && std::isfinite(yMax) && xMax > xMin && yMax > yMin) {
|
||||
range->setXMin(xMin);
|
||||
range->setXMax(xMax);
|
||||
range->setYMin(yMin);
|
||||
range->setYMax(yMax);
|
||||
} else {
|
||||
range->setNullRange();
|
||||
}
|
||||
Poincare::Zoom::SanitizeRange(&xMin, &xMax, &yMin, &yMax, range->NormalYXRatio());
|
||||
|
||||
range->setXMin(xMin);
|
||||
range->setXMax(xMax);
|
||||
range->setYMin(yMin);
|
||||
range->setYMax(yMax);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -137,14 +137,6 @@ void InteractiveCurveViewRange::setDefault() {
|
||||
setZoomAuto(true);
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::setNullRange() {
|
||||
m_xRange.setMin(- Range1D::k_default);
|
||||
setXMax(Range1D::k_default);
|
||||
m_yRange.setMin(0);
|
||||
m_yRange.setMax(0);
|
||||
normalize();
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::centerAxisAround(Axis axis, float position) {
|
||||
if (std::isnan(position)) {
|
||||
return;
|
||||
|
||||
@@ -44,7 +44,6 @@ public:
|
||||
void panWithVector(float x, float y);
|
||||
virtual void normalize();
|
||||
virtual void setDefault();
|
||||
void setNullRange();
|
||||
void centerAxisAround(Axis axis, float position);
|
||||
void panToMakePointVisible(float x, float y, float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation, float pixelWidth);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user