mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Added ability to change width between pinned bar animation entries.
This commit is contained in:
parent
16f616c5e0
commit
1710890886
3 changed files with 9 additions and 3 deletions
|
@ -222,7 +222,7 @@ QRect MessageBar::bodyRect(bool withImage) const {
|
|||
const auto top = st::msgReplyPadding.top();
|
||||
const auto width = _widget.width() - left - st::msgReplyPadding.right();
|
||||
const auto height = st::msgReplyBarSize.height();
|
||||
return QRect(left, top, width, height);
|
||||
return QRect(left, top, width, height) - _content.margins;
|
||||
}
|
||||
|
||||
QRect MessageBar::bodyRect() const {
|
||||
|
|
|
@ -24,6 +24,7 @@ struct MessageBarContent {
|
|||
QString title;
|
||||
TextWithEntities text;
|
||||
QImage preview;
|
||||
style::margins margins;
|
||||
};
|
||||
|
||||
class MessageBar final {
|
||||
|
|
|
@ -51,6 +51,12 @@ void PinnedBar::setContent(rpl::producer<Ui::MessageBarContent> content) {
|
|||
if (creating) {
|
||||
createControls();
|
||||
}
|
||||
|
||||
// In most cases the new right button should arrive
|
||||
// before we want to get its width.
|
||||
const auto right = _right.button ? _right.button->width() : 0;
|
||||
content.margins = { 0, 0, right, 0 };
|
||||
|
||||
_bar->set(std::move(content));
|
||||
if (creating) {
|
||||
_bar->finishAnimating();
|
||||
|
@ -96,8 +102,7 @@ void PinnedBar::setRightButton(object_ptr<Ui::RpWidget> button) {
|
|||
}
|
||||
|
||||
void PinnedBar::updateControlsGeometry(QRect wrapGeometry) {
|
||||
_bar->widget()->resizeToWidth(
|
||||
wrapGeometry.width() - (_right.button ? _right.button->width() : 0));
|
||||
_bar->widget()->resizeToWidth(wrapGeometry.width());
|
||||
const auto hidden = _wrap.isHidden() || !wrapGeometry.height();
|
||||
if (_shadow->isHidden() != hidden) {
|
||||
_shadow->setVisible(!hidden);
|
||||
|
|
Loading…
Add table
Reference in a new issue