Fix ripples in channel comments buttons.

This commit is contained in:
John Preston 2024-04-16 12:49:23 +04:00
parent 49c9e08b6c
commit fe73bf9053

View file

@ -1843,27 +1843,27 @@ void Message::clickHandlerPressedChanged(
Element::clickHandlerPressedChanged(handler, pressed); Element::clickHandlerPressedChanged(handler, pressed);
if (!handler) { if (!handler) {
return; return;
} else if (_rightAction) { } else if (_rightAction && (handler == _rightAction->link)) {
if (_rightAction->second && (handler == _rightAction->second->link)) { toggleRightActionRipple(pressed);
const auto rightSize = rightActionSize(); } else if (_rightAction
Assert(rightSize != std::nullopt); && _rightAction->second
if (pressed) { && (handler == _rightAction->second->link)) {
if (!_rightAction->second->ripple) { const auto rightSize = rightActionSize();
// Create a ripple. Assert(rightSize != std::nullopt);
_rightAction->second->ripple if (pressed) {
= std::make_unique<Ui::RippleAnimation>( if (!_rightAction->second->ripple) {
st::defaultRippleAnimation, // Create a ripple.
Ui::RippleAnimation::RoundRectMask( _rightAction->second->ripple
Size(rightSize->width()), = std::make_unique<Ui::RippleAnimation>(
rightSize->width() / 2), st::defaultRippleAnimation,
[=] { repaint(); }); Ui::RippleAnimation::RoundRectMask(
} Size(rightSize->width()),
_rightAction->second->ripple->add(_rightAction->lastPoint); rightSize->width() / 2),
} else if (_rightAction->second->ripple) { [=] { repaint(); });
_rightAction->second->ripple->lastStop();
} }
} else if (handler == _rightAction->link) { _rightAction->second->ripple->add(_rightAction->lastPoint);
toggleRightActionRipple(pressed); } else if (_rightAction->second->ripple) {
_rightAction->second->ripple->lastStop();
} }
} else if (_comments && (handler == _comments->link)) { } else if (_comments && (handler == _comments->link)) {
toggleCommentsButtonRipple(pressed); toggleCommentsButtonRipple(pressed);