mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Improved casting of limits for std::distance in stack linear chart view.
This commit is contained in:
parent
be82df72e6
commit
ded3f135bb
2 changed files with 5 additions and 3 deletions
|
@ -401,7 +401,9 @@ void ChartWidget::Footer::moveCenter(
|
|||
void ChartWidget::Footer::moveSide(bool left, float64 x) {
|
||||
const auto w = float64(st::statisticsChartFooterSideWidth);
|
||||
const auto mid = float64(st::statisticsChartFooterBetweenSide);
|
||||
if (left) {
|
||||
if (_width < (2 * w + mid)) {
|
||||
return;
|
||||
} else if (left) {
|
||||
const auto min = std::clamp(x, 0., _rightSide.min - w - mid);
|
||||
_leftSide = Limits{ .min = min, .max = min + w };
|
||||
} else if (!left) {
|
||||
|
|
|
@ -905,8 +905,8 @@ int StackLinearChartView::findXIndexByPosition(
|
|||
const auto nearestXPercentageIt = ((right) > (left)) ? (it - 1) : it;
|
||||
return std::clamp(
|
||||
std::distance(begin(chartData.xPercentage), nearestXPercentageIt),
|
||||
long(localStart),
|
||||
long(localEnd));
|
||||
std::ptrdiff_t(localStart),
|
||||
std::ptrdiff_t(localEnd));
|
||||
}
|
||||
|
||||
AbstractChartView::HeightLimits StackLinearChartView::heightLimits(
|
||||
|
|
Loading…
Add table
Reference in a new issue