mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps] Graph/Sequence: correct the layout of the banner views
This commit is contained in:
committed by
EmilieNumworks
parent
9ab4486aa0
commit
7077cb4f58
@@ -4,7 +4,7 @@
|
||||
class Constant {
|
||||
public:
|
||||
constexpr static int LargeNumberOfSignificantDigits = 7;
|
||||
constexpr static int MediumNumberOfSignificantDigits = 6;
|
||||
constexpr static int MediumNumberOfSignificantDigits = 5;
|
||||
constexpr static int ShortNumberOfSignificantDigits = 4;
|
||||
};
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ void GraphControllerHelper::reloadDerivativeInBannerViewForCursorOnFunction(Shar
|
||||
buffer[0] = function->name()[0];
|
||||
buffer[1] = '\'';
|
||||
double y = function->approximateDerivative(cursor->x(), app->localContext());
|
||||
numberOfChar += Complex<double>::convertFloatToText(y, buffer + legendLength, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits), Constant::MediumNumberOfSignificantDigits);
|
||||
numberOfChar += Complex<double>::convertFloatToText(y, buffer + legendLength, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::ShortNumberOfSignificantDigits), Constant::ShortNumberOfSignificantDigits);
|
||||
strlcpy(buffer+numberOfChar, space, spaceLength+1);
|
||||
buffer[Shared::FunctionBannerDelegate::k_maxLegendLength] = 0;
|
||||
buffer[k_maxDigitLegendLength+6] = 0;
|
||||
bannerView()->setLegendAtIndex(buffer, 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Graph {
|
||||
|
||||
class GraphControllerHelper {
|
||||
protected:
|
||||
constexpr static int k_maxDigitLegendLength = 10;
|
||||
bool privateMoveCursorHorizontally(Shared::CurveViewCursor * cursor, int direction, Shared::InteractiveCurveViewRange * range, int numberOfStepsInGradUnit, Shared::Function * function, Shared::TextFieldDelegateApp * app, float cursorTopMarginRatio, float cursorRightMarginRatio, float cursorBottomMarginRatio, float cursorLeftMarginRatio);
|
||||
void reloadDerivativeInBannerViewForCursorOnFunction(Shared::CurveViewCursor * cursor, CartesianFunction * function, Shared::TextFieldDelegateApp * app);
|
||||
virtual Shared::BannerView * bannerView() = 0;
|
||||
|
||||
@@ -17,7 +17,7 @@ void FunctionBannerDelegate::reloadBannerViewForCursorOnFunction(CurveViewCursor
|
||||
buffer[0] = symbol;
|
||||
numberOfChar += Complex<float>::convertFloatToText(cursor->x(), buffer+numberOfChar, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits), Constant::MediumNumberOfSignificantDigits);
|
||||
strlcpy(buffer+numberOfChar, space, spaceLength+1);
|
||||
buffer[k_maxLegendLength] = 0;
|
||||
buffer[k_maxDigitLegendLength+2] = 0;
|
||||
bannerView()->setLegendAtIndex(buffer, 0);
|
||||
|
||||
numberOfChar = 0;
|
||||
@@ -29,7 +29,7 @@ void FunctionBannerDelegate::reloadBannerViewForCursorOnFunction(CurveViewCursor
|
||||
buffer[0] = function->name()[0];
|
||||
numberOfChar += Complex<float>::convertFloatToText(cursor->y(), buffer+legendLength, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits), Constant::MediumNumberOfSignificantDigits);
|
||||
strlcpy(buffer+numberOfChar, space, spaceLength+1);
|
||||
buffer[k_maxLegendLength] = 0;
|
||||
buffer[k_maxDigitLegendLength+5] = 0;
|
||||
bannerView()->setLegendAtIndex(buffer, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace Shared {
|
||||
|
||||
class FunctionBannerDelegate {
|
||||
public:
|
||||
constexpr static int k_maxLegendLength = 14;
|
||||
constexpr static int k_maxNumberOfCharacters = 50;
|
||||
protected:
|
||||
constexpr static int k_maxDigitLegendLength = 11;
|
||||
void reloadBannerViewForCursorOnFunction(CurveViewCursor * cursor, Function * function, char symbol);
|
||||
virtual BannerView * bannerView() = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user