mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[shared] Rename methods
This commit is contained in:
committed by
LeaNumworks
parent
1f8ab10ae5
commit
ffebd2e987
@@ -20,8 +20,8 @@ public:
|
||||
|
||||
// InteractiveCurveViewRangeDelegate
|
||||
bool defaultRangeIsNormalized() const override { return functionStore()->displaysNonCartesianFunctions(); }
|
||||
void interestingRanges(InteractiveCurveViewRange * range) override { InterestingRangesHelper(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); }
|
||||
void interestingRanges(InteractiveCurveViewRange * range) override { DefaultInterestingRanges(range, context(), functionStore(), Ratio()); }
|
||||
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 {}
|
||||
|
||||
private:
|
||||
|
||||
@@ -10,7 +10,7 @@ public:
|
||||
CurveViewRange(Shared::InteractiveCurveViewRangeDelegate * delegate = nullptr);
|
||||
void normalize(bool forceChangeY = false) override;
|
||||
private:
|
||||
virtual bool defaultRangeCriteria() const override { return false; }
|
||||
virtual bool hasDefaultRange() const override { return false; }
|
||||
constexpr static float k_displayLeftMarginRatio = 0.1f;
|
||||
};
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ int FunctionGraphController::numberOfCurves() const {
|
||||
|
||||
void FunctionGraphController::interestingRanges(InteractiveCurveViewRange * range) {
|
||||
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) {
|
||||
return AddMarginHelper(y, range, isVertical, isMin, cursorTopMarginRatio(), cursorBottomMarginRatio(), cursorLeftMarginRatio(), cursorRightMarginRatio());
|
||||
return DefaultAddMargin(y, range, isVertical, isMin, cursorTopMarginRatio(), cursorBottomMarginRatio(), cursorLeftMarginRatio(), cursorRightMarginRatio());
|
||||
}
|
||||
|
||||
void InteractiveCurveViewController::updateZoomButtons() {
|
||||
|
||||
@@ -183,7 +183,7 @@ void InteractiveCurveViewRange::setDefault() {
|
||||
m_delegate->interestingRanges(this);
|
||||
/* If the horizontal bounds are integers, they are preset values and should
|
||||
* not be changed. */
|
||||
bool isDefaultRange = defaultRangeCriteria();
|
||||
bool isDefaultRange = hasDefaultRange();
|
||||
|
||||
// Add margins, then round limits.
|
||||
float newXMin = xMin(), newXMax = xMax();
|
||||
|
||||
@@ -78,7 +78,7 @@ protected:
|
||||
* 2 * 1 unit -> 10.0mm
|
||||
* So normalizedYHalfRange = 43.2mm * 170/240 * 1 unit / 10.0mm */
|
||||
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;
|
||||
private:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
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;
|
||||
float xMins[maxLength], xMaxs[maxLength], yMins[maxLength], yMaxs[maxLength];
|
||||
int length = functionStore->numberOfActiveFunctions();
|
||||
@@ -26,7 +26,7 @@ void InteractiveCurveViewRangeDelegate::InterestingRangesHelper(InteractiveCurve
|
||||
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.
|
||||
* In pixels, the view's height occupied by the vertical range is equal to
|
||||
* viewHeight - topMargin - bottomMargin.
|
||||
|
||||
@@ -13,8 +13,8 @@ class InteractiveCurveViewRangeDelegate {
|
||||
public:
|
||||
static constexpr float k_defaultXHalfRange = 10.0f;
|
||||
|
||||
static void InterestingRangesHelper(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 void DefaultInterestingRanges(InteractiveCurveViewRange * range, Poincare::Context * context, FunctionStore * functionStore, float targetRatio);
|
||||
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 bool defaultRangeIsNormalized() const { return false; }
|
||||
|
||||
Reference in New Issue
Block a user