diff --git a/apps/constant.h b/apps/constant.h index b2e70ce9a..c498624a8 100644 --- a/apps/constant.h +++ b/apps/constant.h @@ -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; }; diff --git a/apps/graph/graph/graph_controller_helper.cpp b/apps/graph/graph/graph_controller_helper.cpp index faa280942..c85ba2b81 100644 --- a/apps/graph/graph/graph_controller_helper.cpp +++ b/apps/graph/graph/graph_controller_helper.cpp @@ -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::convertFloatToText(y, buffer + legendLength, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits), Constant::MediumNumberOfSignificantDigits); + numberOfChar += Complex::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); } diff --git a/apps/graph/graph/graph_controller_helper.h b/apps/graph/graph/graph_controller_helper.h index 2fc0960e0..3122755d9 100644 --- a/apps/graph/graph/graph_controller_helper.h +++ b/apps/graph/graph/graph_controller_helper.h @@ -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; diff --git a/apps/shared/function_banner_delegate.cpp b/apps/shared/function_banner_delegate.cpp index 45060630c..f7b8ffc6a 100644 --- a/apps/shared/function_banner_delegate.cpp +++ b/apps/shared/function_banner_delegate.cpp @@ -17,7 +17,7 @@ void FunctionBannerDelegate::reloadBannerViewForCursorOnFunction(CurveViewCursor buffer[0] = symbol; numberOfChar += Complex::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::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); } diff --git a/apps/shared/function_banner_delegate.h b/apps/shared/function_banner_delegate.h index d557110c8..be824cf3f 100644 --- a/apps/shared/function_banner_delegate.h +++ b/apps/shared/function_banner_delegate.h @@ -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; };