Allow badge in main menu button.

This commit is contained in:
John Preston 2020-06-23 13:13:22 +04:00
parent d31d94e8fb
commit 2a0d189ee2
2 changed files with 5 additions and 3 deletions

View file

@ -473,7 +473,7 @@ void LayerStackWidget::closeLayer(not_null<LayerWidget*> layer) {
return;
}
if (layer == _specialLayer) {
if (layer == _specialLayer || layer == _mainMenu) {
hideAll(anim::type::normal);
} else if (layer == currentLayer()) {
if (_layers.size() == 1) {

View file

@ -145,7 +145,6 @@ const style::icon &SideBarButton::computeIcon() const {
void SideBarButton::validateIconCache() {
Expects(_st.iconPosition.x() < 0);
Expects(_st.iconPosition.y() >= 0);
if (!(_active ? _iconCacheActive : _iconCache).isNull()) {
return;
@ -173,7 +172,10 @@ void SideBarButton::validateIconCache() {
- st::defaultScrollArea.width
- (width() / 2)
+ (icon.width() / 2)));
const auto y = _st.badgePosition.y() - _st.iconPosition.y();
const auto top = (_st.iconPosition.y() >= 0)
? _st.iconPosition.y()
: (height() - icon.height()) / 2;
const auto y = _st.badgePosition.y() - top;
const auto r = _st.badgeHeight / 2.;
p.drawRoundedRect(x, y, _iconCacheBadgeWidth, _st.badgeHeight, r, r);
}