diff --git a/Telegram/SourceFiles/media/player/media_player_widget.cpp b/Telegram/SourceFiles/media/player/media_player_widget.cpp index 9740f893fd..4c75dfebf3 100644 --- a/Telegram/SourceFiles/media/player/media_player_widget.cpp +++ b/Telegram/SourceFiles/media/player/media_player_widget.cpp @@ -82,8 +82,8 @@ public: private: void paintEvent(QPaintEvent *e) override; - QImage prepareRippleMask() const override; QPoint prepareRippleStartPosition() const override; + QImage prepareRippleMask() const override; SpeedButtonLayout _layout; QPoint _layoutPosition; @@ -241,9 +241,10 @@ void Widget::SpeedButton::setSpeed(float64 speed, anim::type animated) { void Widget::SpeedButton::paintEvent(QPaintEvent *e) { auto p = QPainter(this); + const auto innerHeight = st::mediaSpeedButton.icon.height(); paintRipple( p, - QPoint(), + QPoint(0, height() - innerHeight), _isDefault ? &st::mediaPlayerSpeedDisabledRippleBg->c : nullptr); const auto &color = !_isDefault @@ -255,6 +256,23 @@ void Widget::SpeedButton::paintEvent(QPaintEvent *e) { _layout.paint(p, color->c); } +QPoint Widget::SpeedButton::prepareRippleStartPosition() const { + const auto innerHeight = st::mediaSpeedButton.icon.height(); + const auto result = mapFromGlobal(QCursor::pos()) + - QPoint(0, height() - innerHeight); + const auto rect = QRect(0, 0, width(), innerHeight); + return rect.contains(result) + ? result + : DisabledRippleStartPosition(); +} + +QImage Widget::SpeedButton::prepareRippleMask() const { + const auto innerHeight = st::mediaSpeedButton.icon.height(); + return Ui::RippleAnimation::RoundRectMask( + { width(), innerHeight }, + st::mediaPlayerSpeedRadius); +} + Widget::OrderController::OrderController( not_null button, not_null menuParent,