Fix emoji picker button in boxes in non-default scale.

This commit is contained in:
John Preston 2021-03-22 19:40:56 +04:00
parent 0e6d4291a2
commit 56c8327746
3 changed files with 24 additions and 13 deletions

View File

@ -514,6 +514,7 @@ void Launcher::processArguments() {
? style::kScaleAuto
: value;
}
gConfigScale = 110; AssertIsDebug();
}
int Launcher::executeApplication() {

View File

@ -33,23 +33,26 @@ void EmojiButton::paintEvent(QPaintEvent *e) {
const auto loadingState = _loading
? _loading->computeState()
: RadialState{ 0., 0, RadialState::kFull };
const auto icon = _iconOverride ? _iconOverride : &(over ? _st.iconOver : _st.icon);
auto position = _st.iconPosition;
if (position.x() < 0) {
position.setX((width() - icon->width()) / 2);
}
if (position.y() < 0) {
position.setY((height() - icon->height()) / 2);
}
const auto skipx = icon->width() / 4;
const auto skipy = icon->height() / 4;
const auto inner = QRect(
position + QPoint(skipx, skipy),
QSize(icon->width() - 2 * skipx, icon->height() - 2 * skipy));
if (loadingState.shown < 1.) {
p.setOpacity(1. - loadingState.shown);
const auto icon = _iconOverride ? _iconOverride : &(over ? _st.iconOver : _st.icon);
auto position = _st.iconPosition;
if (position.x() < 0) {
position.setX((width() - icon->width()) / 2);
}
if (position.y() < 0) {
position.setY((height() - icon->height()) / 2);
}
icon->paint(p, position, width());
p.setOpacity(1.);
}
QRect inner(QPoint((width() - st::historyEmojiCircle.width()) / 2, (height() - st::historyEmojiCircle.height()) / 2), st::historyEmojiCircle);
const auto color = (_colorOverride
? *_colorOverride
: (over

View File

@ -505,10 +505,11 @@ void Generator::paintComposeArea() {
const auto emojiIconTop = (st::historyAttachEmoji.iconPosition.y() < 0)
? ((st::historyAttachEmoji.height - st::historyAttachEmoji.icon.height()) / 2)
: st::historyAttachEmoji.iconPosition.y();
const auto &emojiIcon = st::historyAttachEmoji.icon[_palette];
right += st::historyAttachEmoji.width;
auto attachEmojiLeft = _composeArea.x() + _composeArea.width() - right;
_p->fillRect(attachEmojiLeft, controlsTop, st::historyAttachEmoji.width, st::historyAttachEmoji.height, st::historyComposeAreaBg[_palette]);
st::historyAttachEmoji.icon[_palette].paint(*_p, attachEmojiLeft + emojiIconLeft, controlsTop + emojiIconTop, _rect.width());
emojiIcon.paint(*_p, attachEmojiLeft + emojiIconLeft, controlsTop + emojiIconTop, _rect.width());
auto pen = st::historyEmojiCircleFg[_palette]->p;
pen.setWidth(st::historyEmojiCircleLine);
@ -517,7 +518,13 @@ void Generator::paintComposeArea() {
_p->setBrush(Qt::NoBrush);
PainterHighQualityEnabler hq(*_p);
auto inner = QRect(QPoint(attachEmojiLeft + (st::historyAttachEmoji.width - st::historyEmojiCircle.width()) / 2, controlsTop + st::historyEmojiCircleTop), st::historyEmojiCircle);
const auto skipx = emojiIcon.width() / 4;
const auto skipy = emojiIcon.height() / 4;
const auto inner = QRect(
attachEmojiLeft + emojiIconLeft + skipx,
controlsTop + emojiIconTop + skipy,
emojiIcon.width() - 2 * skipx,
emojiIcon.height() - 2 * skipy);
_p->drawEllipse(inner);
auto fieldLeft = _composeArea.x() + st::historyAttach.width;