From ce3ad9595039f247e8dca6854fbbd75e1c5eecf4 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 1 Jul 2023 11:29:00 +0300 Subject: [PATCH] Removed useless processing for changing drag direction. --- .../SourceFiles/statistics/chart_widget.cpp | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/Telegram/SourceFiles/statistics/chart_widget.cpp b/Telegram/SourceFiles/statistics/chart_widget.cpp index 3ec51d69ec..04d6afb226 100644 --- a/Telegram/SourceFiles/statistics/chart_widget.cpp +++ b/Telegram/SourceFiles/statistics/chart_widget.cpp @@ -83,7 +83,6 @@ public: [[nodiscard]] rpl::producer xPercentageLimitsChange() const; [[nodiscard]] rpl::producer<> userInteractionFinished() const; - [[nodiscard]] rpl::producer<> directionChanges() const; private: not_null _left; @@ -91,7 +90,6 @@ private: rpl::event_stream _xPercentageLimitsChange; rpl::event_stream<> _userInteractionFinished; - rpl::event_stream<> _directionChanges; struct { int x = 0; @@ -140,8 +138,6 @@ ChartWidget::Footer::Footer(not_null parent) const auto pos = static_cast(e.get())->pos(); switch (e->type()) { case QEvent::MouseMove: { - const auto nowDiffXDirection = (pos.x() - _start.x) < 0; - const auto wasDiffXDirection = _start.diffX < 0; if (base::IsCtrlPressed()) { const auto diff = (pos.x() - _start.x); _left->move(_left->x() + diff, side->y()); @@ -158,9 +154,6 @@ ChartWidget::Footer::Footer(not_null parent) .min = _left->x() / float64(width()), .max = rect::right(_right) / float64(width()), }); - if (nowDiffXDirection != wasDiffXDirection) { - _directionChanges.fire({}); - } } break; case QEvent::MouseButtonPress: { _start.x = pos.x(); @@ -196,10 +189,6 @@ rpl::producer<> ChartWidget::Footer::userInteractionFinished() const { return _userInteractionFinished.events(); } -rpl::producer<> ChartWidget::Footer::directionChanges() const { - return _directionChanges.events(); -} - ChartWidget::ChartAnimationController::ChartAnimationController( Fn &&updateCallback) : _animation(std::move(updateCallback)) { @@ -419,26 +408,6 @@ ChartWidget::ChartWidget(not_null parent) _animationController.start(); }, _footer->lifetime()); - _footer->directionChanges( - ) | rpl::start_with_next([=] { - // _xPercentage.yAnimationStartedAt = crl::now(); - // _xPercentage.animValueYAlpha = anim::value(0., 1.); - - // { - // const auto startXIndex = _chartData.findStartIndex( - // _xPercentage.now.min); - // const auto endXIndex = _chartData.findEndIndex( - // startXIndex, - // _xPercentage.now.max); - // addHorizontalLine( - // { - // float64(FindMinValue(_chartData, startXIndex, endXIndex)), - // float64(FindMaxValue(_chartData, startXIndex, endXIndex)), - // }, - // true); - // } - }, _footer->lifetime()); - _footer->xPercentageLimitsChange( ) | rpl::start_with_next([=](Limits xPercentageLimits) { const auto now = crl::now();