mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[shared] Rename methods
This commit is contained in:
committed by
LeaNumworks
parent
1f8ab10ae5
commit
ffebd2e987
@@ -20,8 +20,8 @@ public:
|
|||||||
|
|
||||||
// InteractiveCurveViewRangeDelegate
|
// InteractiveCurveViewRangeDelegate
|
||||||
bool defaultRangeIsNormalized() const override { return functionStore()->displaysNonCartesianFunctions(); }
|
bool defaultRangeIsNormalized() const override { return functionStore()->displaysNonCartesianFunctions(); }
|
||||||
void interestingRanges(InteractiveCurveViewRange * range) override { InterestingRangesHelper(range, context(), functionStore(), Ratio()); }
|
void interestingRanges(InteractiveCurveViewRange * range) override { DefaultInterestingRanges(range, context(), functionStore(), Ratio()); }
|
||||||
float addMargin(float x, float range, bool isVertical, bool isMin) override { return AddMarginHelper(x, range, isVertical, isMin, k_topMargin, k_bottomMargin, k_leftMargin, k_rightMargin); }
|
float addMargin(float x, float range, bool isVertical, bool isMin) override { return DefaultAddMargin(x, range, isVertical, isMin, k_topMargin, k_bottomMargin, k_leftMargin, k_rightMargin); }
|
||||||
void updateZoomButtons() override {}
|
void updateZoomButtons() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public:
|
|||||||
CurveViewRange(Shared::InteractiveCurveViewRangeDelegate * delegate = nullptr);
|
CurveViewRange(Shared::InteractiveCurveViewRangeDelegate * delegate = nullptr);
|
||||||
void normalize(bool forceChangeY = false) override;
|
void normalize(bool forceChangeY = false) override;
|
||||||
private:
|
private:
|
||||||
virtual bool defaultRangeCriteria() const override { return false; }
|
virtual bool hasDefaultRange() const override { return false; }
|
||||||
constexpr static float k_displayLeftMarginRatio = 0.1f;
|
constexpr static float k_displayLeftMarginRatio = 0.1f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ int FunctionGraphController::numberOfCurves() const {
|
|||||||
|
|
||||||
void FunctionGraphController::interestingRanges(InteractiveCurveViewRange * range) {
|
void FunctionGraphController::interestingRanges(InteractiveCurveViewRange * range) {
|
||||||
float ratio = InteractiveCurveViewRange::NormalYXRatio() / (1 + cursorTopMarginRatio() + cursorBottomMarginRatio());
|
float ratio = InteractiveCurveViewRange::NormalYXRatio() / (1 + cursorTopMarginRatio() + cursorBottomMarginRatio());
|
||||||
InterestingRangesHelper(range, textFieldDelegateApp()->localContext(), functionStore(), ratio);
|
DefaultInterestingRanges(range, textFieldDelegateApp()->localContext(), functionStore(), ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ InteractiveCurveViewController::InteractiveCurveViewController(Responder * paren
|
|||||||
}
|
}
|
||||||
|
|
||||||
float InteractiveCurveViewController::addMargin(float y, float range, bool isVertical, bool isMin) {
|
float InteractiveCurveViewController::addMargin(float y, float range, bool isVertical, bool isMin) {
|
||||||
return AddMarginHelper(y, range, isVertical, isMin, cursorTopMarginRatio(), cursorBottomMarginRatio(), cursorLeftMarginRatio(), cursorRightMarginRatio());
|
return DefaultAddMargin(y, range, isVertical, isMin, cursorTopMarginRatio(), cursorBottomMarginRatio(), cursorLeftMarginRatio(), cursorRightMarginRatio());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveCurveViewController::updateZoomButtons() {
|
void InteractiveCurveViewController::updateZoomButtons() {
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void InteractiveCurveViewRange::setDefault() {
|
|||||||
m_delegate->interestingRanges(this);
|
m_delegate->interestingRanges(this);
|
||||||
/* If the horizontal bounds are integers, they are preset values and should
|
/* If the horizontal bounds are integers, they are preset values and should
|
||||||
* not be changed. */
|
* not be changed. */
|
||||||
bool isDefaultRange = defaultRangeCriteria();
|
bool isDefaultRange = hasDefaultRange();
|
||||||
|
|
||||||
// Add margins, then round limits.
|
// Add margins, then round limits.
|
||||||
float newXMin = xMin(), newXMax = xMax();
|
float newXMin = xMin(), newXMax = xMax();
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ protected:
|
|||||||
* 2 * 1 unit -> 10.0mm
|
* 2 * 1 unit -> 10.0mm
|
||||||
* So normalizedYHalfRange = 43.2mm * 170/240 * 1 unit / 10.0mm */
|
* So normalizedYHalfRange = 43.2mm * 170/240 * 1 unit / 10.0mm */
|
||||||
constexpr static float NormalizedYHalfRange(float unit) { return 3.06f * unit; }
|
constexpr static float NormalizedYHalfRange(float unit) { return 3.06f * unit; }
|
||||||
virtual bool defaultRangeCriteria() const { return (xMin() == std::round(xMin())) && (xMax() == std::round(xMax())); }
|
virtual bool hasDefaultRange() const { return (xMin() == std::round(xMin())) && (xMax() == std::round(xMax())); }
|
||||||
|
|
||||||
InteractiveCurveViewRangeDelegate * m_delegate;
|
InteractiveCurveViewRangeDelegate * m_delegate;
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace Shared {
|
namespace Shared {
|
||||||
|
|
||||||
void InteractiveCurveViewRangeDelegate::InterestingRangesHelper(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio) {
|
void InteractiveCurveViewRangeDelegate::DefaultInterestingRanges(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio) {
|
||||||
constexpr int maxLength = 10;
|
constexpr int maxLength = 10;
|
||||||
float xMins[maxLength], xMaxs[maxLength], yMins[maxLength], yMaxs[maxLength];
|
float xMins[maxLength], xMaxs[maxLength], yMins[maxLength], yMaxs[maxLength];
|
||||||
int length = functionStore->numberOfActiveFunctions();
|
int length = functionStore->numberOfActiveFunctions();
|
||||||
@@ -26,7 +26,7 @@ void InteractiveCurveViewRangeDelegate::InterestingRangesHelper(InteractiveCurve
|
|||||||
range->setYMax(yMax);
|
range->setYMax(yMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
float InteractiveCurveViewRangeDelegate::AddMarginHelper(float x, float range, bool isVertical, bool isMin, float top, float bottom, float left, float right) {
|
float InteractiveCurveViewRangeDelegate::DefaultAddMargin(float x, float range, bool isVertical, bool isMin, float top, float bottom, float left, float right) {
|
||||||
/* The provided min or max range limit y is altered by adding a margin.
|
/* The provided min or max range limit y is altered by adding a margin.
|
||||||
* In pixels, the view's height occupied by the vertical range is equal to
|
* In pixels, the view's height occupied by the vertical range is equal to
|
||||||
* viewHeight - topMargin - bottomMargin.
|
* viewHeight - topMargin - bottomMargin.
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class InteractiveCurveViewRangeDelegate {
|
|||||||
public:
|
public:
|
||||||
static constexpr float k_defaultXHalfRange = 10.0f;
|
static constexpr float k_defaultXHalfRange = 10.0f;
|
||||||
|
|
||||||
static void InterestingRangesHelper(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio);
|
static void DefaultInterestingRanges(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio);
|
||||||
static float AddMarginHelper(float x, float range, bool isVertical, bool isMin, float top, float bottom, float left, float right);
|
static float DefaultAddMargin(float x, float range, bool isVertical, bool isMin, float top, float bottom, float left, float right);
|
||||||
|
|
||||||
virtual float interestingXMin() const { return -k_defaultXHalfRange; }
|
virtual float interestingXMin() const { return -k_defaultXHalfRange; }
|
||||||
virtual bool defaultRangeIsNormalized() const { return false; }
|
virtual bool defaultRangeIsNormalized() const { return false; }
|
||||||
|
|||||||
Reference in New Issue
Block a user