Fixed blobs paint for non-default scales.

This commit is contained in:
23rd 2020-11-30 10:59:21 +03:00 committed by John Preston
parent 1b2869d9c9
commit 011d0ba692
2 changed files with 33 additions and 17 deletions

View file

@ -28,13 +28,10 @@ constexpr auto kScaleSmall = 0.704 - 0.1;
constexpr auto kScaleBigMin = 0.878; constexpr auto kScaleBigMin = 0.878;
constexpr auto kScaleSmallMin = 0.926; constexpr auto kScaleSmallMin = 0.926;
constexpr auto kScaleBigMax = kScaleBigMin + kScaleBig; constexpr auto kScaleBigMax = (float)(kScaleBigMin + kScaleBig);
constexpr auto kScaleSmallMax = kScaleSmallMin + kScaleSmall; constexpr auto kScaleSmallMax = (float)(kScaleSmallMin + kScaleSmall);
constexpr auto kMainRadiusFactor = 50. / 57.; constexpr auto kMainRadiusFactor = (float)(50. / 57.);
constexpr auto kMainMinRadius = 57. * kMainRadiusFactor;
constexpr auto kMainMaxRadius = 63. * kMainRadiusFactor;
constexpr auto kGlowPaddingFactor = 1.2; constexpr auto kGlowPaddingFactor = 1.2;
constexpr auto kGlowMinScale = 0.6; constexpr auto kGlowMinScale = 0.6;
@ -42,29 +39,39 @@ constexpr auto kGlowAlpha = 150;
constexpr auto kSwitchStateDuration = 120; constexpr auto kSwitchStateDuration = 120;
constexpr auto MuteBlobs() -> std::array<Paint::Blobs::BlobData, 3> { auto MuteBlobs() -> std::array<Paint::Blobs::BlobData, 3> {
return {{ return {{
{ {
.segmentsCount = 6, .segmentsCount = 6,
.minScale = 1., .minScale = 1.,
.minRadius = kMainMinRadius, .minRadius = st::callMuteMainBlobMinRadius
.maxRadius = kMainMaxRadius, * kMainRadiusFactor,
.maxRadius = st::callMuteMainBlobMaxRadius
* kMainRadiusFactor,
.speedScale = .4, .speedScale = .4,
.alpha = 1., .alpha = 1.,
}, },
{ {
.segmentsCount = 9, .segmentsCount = 9,
.minScale = kScaleSmallMin / kScaleSmallMax, .minScale = kScaleSmallMin / kScaleSmallMax,
.minRadius = 62 * kScaleSmallMax * kMainRadiusFactor, .minRadius = st::callMuteMinorBlobMinRadius
.maxRadius = 72 * kScaleSmallMax * kMainRadiusFactor, * kScaleSmallMax
* kMainRadiusFactor,
.maxRadius = st::callMuteMinorBlobMaxRadius
* kScaleSmallMax
* kMainRadiusFactor,
.speedScale = 1., .speedScale = 1.,
.alpha = (76. / 255.), .alpha = (76. / 255.),
}, },
{ {
.segmentsCount = 12, .segmentsCount = 12,
.minScale = kScaleBigMin / kScaleBigMax, .minScale = kScaleBigMin / kScaleBigMax,
.minRadius = 65 * kScaleBigMax * kMainRadiusFactor, .minRadius = st::callMuteMajorBlobMinRadius
.maxRadius = 75 * kScaleBigMax * kMainRadiusFactor, * kScaleBigMax
* kMainRadiusFactor,
.maxRadius = st::callMuteMajorBlobMaxRadius
* kScaleBigMax
* kMainRadiusFactor,
.speedScale = 1., .speedScale = 1.,
.alpha = (76. / 255.), .alpha = (76. / 255.),
}, },
@ -171,7 +178,9 @@ void BlobsWidget::init() {
p.translate(_center, _center); p.translate(_center, _center);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(_blobBrush); p.setBrush(_blobBrush);
p.drawEllipse(QPointF(), kMainMinRadius, kMainMinRadius); const auto radius = st::callMuteMainBlobMinRadius
* kMainRadiusFactor;
p.drawEllipse(QPointF(), radius, radius);
return; return;
} }
@ -351,9 +360,9 @@ void CallMuteButton::init() {
{ {
auto radius = _state.value( auto radius = _state.value(
) | rpl::map([](const CallMuteButtonState &state) -> float { ) | rpl::map([](const CallMuteButtonState &state) -> float {
return IsConnecting(state.type) return (IsConnecting(state.type)
? kMainMinRadius ? st::callMuteMainBlobMinRadius
: kMainMaxRadius; : st::callMuteMainBlobMaxRadius) * kMainRadiusFactor;
}) | rpl::distinct_until_changed(); }) | rpl::distinct_until_changed();
_blobs->setMainRadius(std::move(radius)); _blobs->setMainRadius(std::move(radius));
} }

View file

@ -1405,6 +1405,13 @@ defaultToast: Toast {
durationSlide: 160; durationSlide: 160;
} }
callMuteMainBlobMinRadius: 57px;
callMuteMainBlobMaxRadius: 63px;
callMuteMinorBlobMinRadius: 62px;
callMuteMinorBlobMaxRadius: 72px;
callMuteMajorBlobMinRadius: 65px;
callMuteMajorBlobMaxRadius: 75px;
callMuteButtonActiveIcon: icon {{ "calls/voice_unmuted_large", groupCallIconFg }}; callMuteButtonActiveIcon: icon {{ "calls/voice_unmuted_large", groupCallIconFg }};
callMuteButtonActiveInner: IconButton { callMuteButtonActiveInner: IconButton {
width: 136px; width: 136px;