Added transforming blob to circle in mute button for connecting state.
This commit is contained in:
parent
0018276c5f
commit
ee969568ac
1 changed files with 21 additions and 2 deletions
|
|
@ -33,6 +33,9 @@ constexpr auto kScaleSmallMax = kScaleSmallMin + kScaleSmall;
|
|||
|
||||
constexpr auto kMainRadiusFactor = 50. / 57.;
|
||||
|
||||
constexpr auto kMainMinRadius = 57. * kMainRadiusFactor;
|
||||
constexpr auto kMainMaxRadius = 63. * kMainRadiusFactor;
|
||||
|
||||
constexpr auto kSwitchStateDuration = 120;
|
||||
|
||||
constexpr auto MuteBlobs() -> std::array<Paint::Blobs::BlobData, 3> {
|
||||
|
|
@ -40,8 +43,8 @@ constexpr auto MuteBlobs() -> std::array<Paint::Blobs::BlobData, 3> {
|
|||
{
|
||||
.segmentsCount = 6,
|
||||
.minScale = 1.,
|
||||
.minRadius = 57. * kMainRadiusFactor,
|
||||
.maxRadius = 63. * kMainRadiusFactor,
|
||||
.minRadius = kMainMinRadius,
|
||||
.maxRadius = kMainMaxRadius,
|
||||
.speedScale = .4,
|
||||
.alpha = 1.,
|
||||
},
|
||||
|
|
@ -105,6 +108,7 @@ public:
|
|||
|
||||
void setLevel(float level);
|
||||
void setBrush(QBrush brush);
|
||||
void setMainRadius(rpl::producer<float> &&radius);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
|
@ -178,6 +182,10 @@ void BlobsWidget::setLevel(float level) {
|
|||
_blobs.setLevel(level);
|
||||
}
|
||||
|
||||
void BlobsWidget::setMainRadius(rpl::producer<float> &&radius) {
|
||||
_blobs.setRadiusAt(std::move(radius), 0, true);
|
||||
}
|
||||
|
||||
CallMuteButton::CallMuteButton(
|
||||
not_null<RpWidget*> parent,
|
||||
CallMuteButtonState initial)
|
||||
|
|
@ -276,6 +284,17 @@ void CallMuteButton::init() {
|
|||
icon.height());
|
||||
}, lifetime());
|
||||
|
||||
// Main blob radius.
|
||||
{
|
||||
auto radius = _state.value(
|
||||
) | rpl::map([](const CallMuteButtonState &state) -> float {
|
||||
return IsConnecting(state.type)
|
||||
? kMainMinRadius
|
||||
: kMainMaxRadius;
|
||||
}) | rpl::distinct_until_changed();
|
||||
_blobs->setMainRadius(std::move(radius));
|
||||
}
|
||||
|
||||
// Paint.
|
||||
auto filterCallback = [=](not_null<QEvent*> e) {
|
||||
if (e->type() != QEvent::Paint) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue