mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed display of selected days in zoomed stack linear chart view.
This commit is contained in:
parent
5a2b8d06e3
commit
21c1ba7607
3 changed files with 25 additions and 9 deletions
|
@ -1267,15 +1267,31 @@ void ChartWidget::processLocalZoom(int xIndex) {
|
||||||
|
|
||||||
zoomOutButton->moveToLeft(0, 0);
|
zoomOutButton->moveToLeft(0, 0);
|
||||||
|
|
||||||
const auto finish = [=](const Limits &zoomLimit) {
|
const auto finish = [=](const Limits &zoomLimitIndices) {
|
||||||
_footer->xPercentageLimitsChange(
|
_footer->xPercentageLimitsChange(
|
||||||
) | rpl::start_with_next([=](const Limits &l) {
|
) | rpl::start_with_next([=](const Limits &l) {
|
||||||
const auto result = FindNearestElements(
|
const auto zoomLimit = Limits{
|
||||||
|
_chartData.xPercentage[zoomLimitIndices.min],
|
||||||
|
_chartData.xPercentage[zoomLimitIndices.max],
|
||||||
|
};
|
||||||
|
const auto offset = (zoomLimit.max == 1.) ? 0 : -1;
|
||||||
|
const auto minIt = ranges::upper_bound(
|
||||||
_chartData.xPercentage,
|
_chartData.xPercentage,
|
||||||
Limits{
|
anim::interpolateF(zoomLimit.min, zoomLimit.max, l.min));
|
||||||
anim::interpolateF(zoomLimit.min, zoomLimit.max, l.min),
|
const auto maxIt = ranges::upper_bound(
|
||||||
anim::interpolateF(zoomLimit.min, zoomLimit.max, l.max),
|
_chartData.xPercentage,
|
||||||
});
|
anim::interpolateF(zoomLimit.min, zoomLimit.max, l.max));
|
||||||
|
const auto start = begin(_chartData.xPercentage);
|
||||||
|
const auto result = Limits{
|
||||||
|
.min = std::clamp(
|
||||||
|
float64(std::distance(start, minIt) + offset),
|
||||||
|
zoomLimitIndices.min,
|
||||||
|
zoomLimitIndices.max),
|
||||||
|
.max = std::clamp(
|
||||||
|
float64(std::distance(start, maxIt) + offset),
|
||||||
|
zoomLimitIndices.min,
|
||||||
|
zoomLimitIndices.max),
|
||||||
|
};
|
||||||
header->setRightInfo(HeaderRightInfo(_chartData, result));
|
header->setRightInfo(HeaderRightInfo(_chartData, result));
|
||||||
header->update();
|
header->update();
|
||||||
}, header->lifetime());
|
}, header->lifetime());
|
||||||
|
@ -1301,7 +1317,7 @@ void ChartWidget::processLocalZoom(int xIndex) {
|
||||||
if (lifetime) {
|
if (lifetime) {
|
||||||
lifetime->destroy();
|
lifetime->destroy();
|
||||||
}
|
}
|
||||||
finish(zoom.limit);
|
finish(zoom.limitIndices);
|
||||||
}
|
}
|
||||||
}, 0., 1., kFooterZoomDuration, anim::easeOutCirc);
|
}, 0., 1., kFooterZoomDuration, anim::easeOutCirc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
|
|
||||||
struct LocalZoomResult final {
|
struct LocalZoomResult final {
|
||||||
bool hasZoom = false;
|
bool hasZoom = false;
|
||||||
Limits limit;
|
Limits limitIndices;
|
||||||
Limits range;
|
Limits range;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -972,7 +972,7 @@ auto StackLinearChartView::maybeLocalZoom(
|
||||||
_transition.zoomedInLimit.max,
|
_transition.zoomedInLimit.max,
|
||||||
_transition.zoomedInRange.max),
|
_transition.zoomedInRange.max),
|
||||||
};
|
};
|
||||||
return { true, _transition.zoomedInLimit, resultRange };
|
return { true, _transition.zoomedInLimitXIndices, resultRange };
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackLinearChartView::tick(crl::time now) {
|
void StackLinearChartView::tick(crl::time now) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue