2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Improved style of widget for details of selected points on chart.

This commit is contained in:
23rd
2023-10-03 05:19:41 +03:00
committed by John Preston
parent 42fc4fbb31
commit 3425b40746
4 changed files with 157 additions and 68 deletions

View File

@@ -1189,16 +1189,20 @@ void ChartWidget::setupDetails() {
currentXLimits.min,
currentXLimits.max,
_chartData.xPercentage[nearestXIndex]);
const auto xLeft = currentX
- _details.widget->width();
const auto widgetArea = _details.widget->width()
+ st::statisticsDetailsPopupPadding.left();
const auto xLeft = currentX - widgetArea;
const auto x = (xLeft >= 0)
? xLeft
: ((currentX
+ _details.widget->width()
- _chartArea->width()) > 0)
: ((currentX + widgetArea - _chartArea->width()) > 0)
? 0
: currentX;
_details.widget->moveToLeft(x, _chartArea->y());
_details.widget->moveToLeft(
std::clamp(
int(x),
_chartArea->x(),
rect::right(_chartArea) - widgetArea),
_chartArea->y());
_details.widget->setXIndex(nearestXIndex);
if (_details.widget->isHidden()) {
_details.hideOnAnimationEnd = false;