Improved static infinite radial animation in panel of webview bot.

This commit is contained in:
23rd 2024-08-21 19:25:58 +03:00
parent d143e32022
commit 4ee7d46d78

View file

@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/fade_wrap.h" #include "ui/wrap/fade_wrap.h"
#include "ui/integration.h" #include "ui/integration.h"
#include "ui/painter.h" #include "ui/painter.h"
#include "ui/rect.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "webview/webview_embed.h" #include "webview/webview_embed.h"
#include "webview/webview_dialog.h" #include "webview/webview_dialog.h"
@ -397,14 +398,13 @@ void Panel::toggleProgress(bool shown) {
auto p = QPainter(&_progress->widget); auto p = QPainter(&_progress->widget);
p.setOpacity( p.setOpacity(
_progress->shownAnimation.value(_progress->shown ? 1. : 0.)); _progress->shownAnimation.value(_progress->shown ? 1. : 0.));
auto thickness = st::paymentsLoading.thickness; const auto thickness = st::paymentsLoading.thickness;
if (progressWithBackground()) { if (progressWithBackground()) {
auto color = st::windowBg->c; auto color = st::windowBg->c;
color.setAlphaF(kProgressOpacity); color.setAlphaF(kProgressOpacity);
p.fillRect(clip, color); p.fillRect(clip, color);
} }
const auto rect = progressRect().marginsRemoved( const auto rect = progressRect() - Margins(thickness);
{ thickness, thickness, thickness, thickness });
InfiniteRadialAnimation::Draw( InfiniteRadialAnimation::Draw(
p, p,
_progress->animation.computeState(), _progress->animation.computeState(),
@ -412,7 +412,7 @@ void Panel::toggleProgress(bool shown) {
rect.size() - QSize(), rect.size() - QSize(),
_progress->widget.width(), _progress->widget.width(),
st::paymentsLoading.color, st::paymentsLoading.color,
thickness); anim::Disabled() ? (thickness / 2.) : thickness);
}, _progress->widget.lifetime()); }, _progress->widget.lifetime());
_progress->widget.show(); _progress->widget.show();
_progress->animation.start(); _progress->animation.start();