2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Added support of very large values in PointDetailsWidget.

This commit is contained in:
23rd
2023-07-11 03:58:46 +03:00
committed by John Preston
parent 25f401c22e
commit 40ab042fb5
4 changed files with 51 additions and 10 deletions

View File

@@ -823,7 +823,13 @@ void ChartWidget::setupDetails() {
}
_details.widget = base::make_unique_q<PointDetailsWidget>(
this,
_chartData);
_chartData,
FindHeightLimitsBetweenXLimits(
_chartData,
{
_chartData.xPercentage.front(),
_chartData.xPercentage.back(),
}).max);
_chartArea->mouseStateChanged(
) | rpl::start_with_next([=](const RpMouseWidget::State &state) {
@@ -856,9 +862,13 @@ void ChartWidget::setupDetails() {
*nearestXPercentageIt);
const auto xLeft = _details.currentX
- _details.widget->width();
const auto x = (xLeft < 0)
? (_details.currentX)
: xLeft;
const auto x = (xLeft >= 0)
? xLeft
: ((_details.currentX
+ _details.widget->width()
- _chartArea->width()) > 0)
? 0
: _details.currentX;
_details.widget->moveToLeft(x, _chartArea->y());
_details.widget->setXIndex(nearestXIndex);
_details.widget->show();