diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 8be69b082..97ce9013f 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1292,6 +1292,7 @@ PRIVATE statistics/segment_tree.h statistics/statistics_box.cpp statistics/statistics_box.h + statistics/statistics_common.h statistics/statistics_data_deserialize.cpp statistics/statistics_data_deserialize.h storage/details/storage_file_utilities.cpp diff --git a/Telegram/SourceFiles/statistics/chart_widget.cpp b/Telegram/SourceFiles/statistics/chart_widget.cpp index cb78a7b96..17be748d0 100644 --- a/Telegram/SourceFiles/statistics/chart_widget.cpp +++ b/Telegram/SourceFiles/statistics/chart_widget.cpp @@ -73,10 +73,14 @@ class ChartWidget::Footer final : public Ui::AbstractButton { public: Footer(not_null parent); + [[nodiscard]] rpl::producer xPercentageLimitsChange() const; + private: not_null _left; not_null _right; + rpl::event_stream _xPercentageLimitsChange; + struct { int x = 0; int leftLimit = 0; @@ -135,6 +139,10 @@ ChartWidget::Footer::Footer(not_null parent) _start.rightLimit = rightLimit(); } break; case QEvent::MouseButtonRelease: { + _xPercentageLimitsChange.fire({ + .min = _left->x() / float64(width()), + .max = rect::right(_right) / float64(width()), + }); _start = {}; } break; } @@ -150,6 +158,10 @@ ChartWidget::Footer::Footer(not_null parent) [=] { return width() - _right->width(); }); } +rpl::producer ChartWidget::Footer::xPercentageLimitsChange() const { + return _xPercentageLimitsChange.events(); +} + ChartWidget::ChartWidget(not_null parent) : Ui::RpWidget(parent) , _footer(std::make_unique