Fixed limit of days for zoom in stack linear chart view.

This commit is contained in:
23rd 2023-09-26 02:43:08 +03:00 committed by John Preston
parent 65ccb4059e
commit 9046daa1a6

View file

@ -907,12 +907,12 @@ AbstractChartView::HeightLimits StackLinearChartView::heightLimits(
auto StackLinearChartView::maybeLocalZoom( auto StackLinearChartView::maybeLocalZoom(
const LocalZoomArgs &args) -> LocalZoomResult { const LocalZoomArgs &args) -> LocalZoomResult {
// 7 days. // 8 days.
constexpr auto kLimitLength = int(27); constexpr auto kLimitLength = int(8);
// 1 day in middle of limits. // 1 day in middle of limits.
constexpr auto kRangeLength = int(1); constexpr auto kRangeLength = int(0);
constexpr auto kLeftSide = int(kLimitLength / 2); constexpr auto kLeftSide = int(kLimitLength / 2 + kRangeLength);
constexpr auto kRightSide = int(kLimitLength / 2 + kRangeLength); constexpr auto kRightSide = int(kLimitLength / 2);
_transition.progress = args.progress; _transition.progress = args.progress;
if (args.type == LocalZoomArgs::Type::SkipCalculation) { if (args.type == LocalZoomArgs::Type::SkipCalculation) {
@ -937,8 +937,8 @@ auto StackLinearChartView::maybeLocalZoom(
float64(localRangeIndex + kRangeLength), float64(localRangeIndex + kRangeLength),
}; };
_transition.zoomedInLimitXIndices = (xIndex < kLeftSide) _transition.zoomedInLimitXIndices = (xIndex < kLeftSide)
? Limits{ 0, kLimitLength } ? Limits{ 0, kLimitLength + kRangeLength }
: (xIndex > (backIndex - kRightSide)) : (xIndex > (backIndex - kRightSide - kRangeLength))
? Limits{ float64(backIndex - kLimitLength), float64(backIndex) } ? Limits{ float64(backIndex - kLimitLength), float64(backIndex) }
: Limits{ float64(xIndex - kLeftSide), float64(xIndex + kRightSide) }; : Limits{ float64(xIndex - kLeftSide), float64(xIndex + kRightSide) };
_transition.zoomedInLimit = { _transition.zoomedInLimit = {