mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Removed animation of summarize button when it is not hovered.
This commit is contained in:
@@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "ui/power_saving.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "styles/style_chat.h"
|
||||
@@ -900,11 +901,21 @@ void Reply::paint(
|
||||
colorCollectible)
|
||||
: stm->msgServiceFg->c;
|
||||
_summarize->particles.setColor(nameColor);
|
||||
const auto paused = context.paused || On(PowerSaving::kChatEffects);
|
||||
_summarize->particles.paint(
|
||||
p,
|
||||
QRect(0, 0, w, _height),
|
||||
context.now,
|
||||
context.paused);
|
||||
paused);
|
||||
if (!paused) {
|
||||
const auto session = &view->history()->session();
|
||||
const auto r = QRect(x, y, w, _height);
|
||||
Ui::PostponeCall(session, [=, itemId = view->data()->fullId()] {
|
||||
if (const auto i = session->data().message(itemId)) {
|
||||
session->data().requestItemRepaint(i, r);
|
||||
}
|
||||
});
|
||||
}
|
||||
p.setClipping(false);
|
||||
p.translate(-x, -y);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/effects/ministar_particles.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/power_saving.h"
|
||||
#include "ui/rect.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "api/api_transcribes.h"
|
||||
@@ -138,14 +139,19 @@ void TranscribeButton::paint(
|
||||
_particles->setSpeed(0.2);
|
||||
}
|
||||
p.setClipRegion(QRegion(r, QRegion::Ellipse));
|
||||
_particles->paint(p, r, context.now, context.paused);
|
||||
const auto paused = context.paused
|
||||
|| (!_summarizeHovered && !_loading)
|
||||
|| On(PowerSaving::kChatEffects);
|
||||
_particles->paint(p, r, context.now, paused);
|
||||
p.setClipping(false);
|
||||
const auto session = &_item->history()->session();
|
||||
Ui::PostponeCall(session, [=, itemId = _item->fullId()] {
|
||||
if (const auto item = session->data().message(itemId)) {
|
||||
session->data().requestItemRepaint(item);
|
||||
}
|
||||
});
|
||||
if (!paused) {
|
||||
const auto session = &_item->history()->session();
|
||||
Ui::PostponeCall(session, [=, itemId = _item->fullId()] {
|
||||
if (const auto i = session->data().message(itemId)) {
|
||||
session->data().requestItemRepaint(i, r);
|
||||
}
|
||||
});
|
||||
}
|
||||
(_item->history()->session().api().transcribes().summary(
|
||||
_item).shown
|
||||
? st::mediaviewFullScreenButton.icon
|
||||
@@ -339,7 +345,12 @@ ClickHandlerPtr TranscribeButton::link() {
|
||||
|
||||
bool TranscribeButton::contains(const QPoint &p) {
|
||||
_lastStatePoint = p - _lastPaintedPoint;
|
||||
return QRect(_lastPaintedPoint, size()).contains(p);
|
||||
if (_summarize) {
|
||||
_summarizeHovered = QRect(_lastPaintedPoint, size()).contains(p);
|
||||
return _summarizeHovered;
|
||||
} else {
|
||||
return QRect(_lastPaintedPoint, size()).contains(p);
|
||||
}
|
||||
}
|
||||
|
||||
void TranscribeButton::addRipple(Fn<void()> callback) {
|
||||
|
||||
@@ -48,16 +48,17 @@ private:
|
||||
const bool _summarize = false;
|
||||
const QSize _size;
|
||||
|
||||
mutable std::unique_ptr<Ui::InfiniteRadialAnimation> _animation;
|
||||
mutable std::unique_ptr<Ui::StarParticles> _particles;
|
||||
std::unique_ptr<Ui::RippleAnimation> _ripple;
|
||||
ClickHandlerPtr _link;
|
||||
QString _text;
|
||||
std::unique_ptr<Ui::InfiniteRadialAnimation> _animation;
|
||||
std::unique_ptr<Ui::StarParticles> _particles;
|
||||
std::unique_ptr<Ui::RippleAnimation> _ripple;
|
||||
Ui::Animations::Simple _openedAnimation;
|
||||
bool _loading = false;
|
||||
bool _opened = false;
|
||||
QString _text;
|
||||
QPoint _lastPaintedPoint;
|
||||
QPoint _lastStatePoint;
|
||||
bool _summarizeHovered = false;
|
||||
bool _loading = false;
|
||||
bool _opened = false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user