Fixed computing of inner rect from mute button.
This commit is contained in:
parent
417413f026
commit
d5a076ccef
1 changed files with 14 additions and 9 deletions
|
|
@ -133,7 +133,7 @@ public:
|
||||||
void setBlobBrush(QBrush brush);
|
void setBlobBrush(QBrush brush);
|
||||||
void setGlowBrush(QBrush brush);
|
void setGlowBrush(QBrush brush);
|
||||||
|
|
||||||
[[nodiscard]] QRect innerRect() const;
|
[[nodiscard]] QRectF innerRect() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
@ -143,7 +143,7 @@ private:
|
||||||
QBrush _blobBrush;
|
QBrush _blobBrush;
|
||||||
QBrush _glowBrush;
|
QBrush _glowBrush;
|
||||||
int _center = 0;
|
int _center = 0;
|
||||||
QRect _inner;
|
QRectF _inner;
|
||||||
|
|
||||||
crl::time _blobsLastTime = 0;
|
crl::time _blobsLastTime = 0;
|
||||||
crl::time _blobsHideLastTime = 0;
|
crl::time _blobsHideLastTime = 0;
|
||||||
|
|
@ -200,9 +200,9 @@ void BlobsWidget::init() {
|
||||||
) | rpl::start_with_next([=](QSize size) {
|
) | rpl::start_with_next([=](QSize size) {
|
||||||
_center = size.width() / 2;
|
_center = size.width() / 2;
|
||||||
|
|
||||||
const auto w = _blobs.maxRadius() * 2;
|
const auto w = (size.width() - _blobs.maxRadius() * 2) / 2.;
|
||||||
const auto margins = style::margins(w, w, w, w);
|
const auto margins = QMarginsF(w, w, w, w);
|
||||||
_inner = QRect(QPoint(), size).marginsRemoved(margins);
|
_inner = QRectF(QPoint(), size).marginsRemoved(margins);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
paintRequest(
|
paintRequest(
|
||||||
|
|
@ -246,7 +246,7 @@ void BlobsWidget::init() {
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect BlobsWidget::innerRect() const {
|
QRectF BlobsWidget::innerRect() const {
|
||||||
return _inner;
|
return _inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -344,11 +344,16 @@ void CallMuteButton::init() {
|
||||||
lifetime().make_state<CallMuteButtonType>(_state.current().type);
|
lifetime().make_state<CallMuteButtonType>(_state.current().type);
|
||||||
setEnableMouse(false);
|
setEnableMouse(false);
|
||||||
|
|
||||||
const auto blobsInner = _blobs->innerRect();
|
const auto blobsInner = [&] {
|
||||||
|
// The point of the circle at 45 degrees.
|
||||||
|
const auto mF = std::sqrt(_blobs->innerRect().width()) / 2.;
|
||||||
|
return _blobs->innerRect().marginsRemoved(QMarginsF(mF, mF, mF, mF));
|
||||||
|
}();
|
||||||
|
|
||||||
auto linearGradients = anim::linear_gradients<CallMuteButtonType>(
|
auto linearGradients = anim::linear_gradients<CallMuteButtonType>(
|
||||||
_colors,
|
_colors,
|
||||||
QPointF(blobsInner.x(), blobsInner.y() + blobsInner.height()),
|
QPointF(blobsInner.x() + blobsInner.width(), blobsInner.y()),
|
||||||
QPointF(blobsInner.x() + blobsInner.width(), blobsInner.y()));
|
QPointF(blobsInner.x(), blobsInner.y() + blobsInner.height()));
|
||||||
|
|
||||||
auto glowColors = [&] {
|
auto glowColors = [&] {
|
||||||
auto copy = _colors;
|
auto copy = _colors;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue