From 1204e282d33060f85aceff9fd9b3c4fcec0fc08d Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 28 Sep 2021 12:18:14 +0400 Subject: [PATCH] Fix attach icon in theme preview. --- .../SourceFiles/window/themes/window_theme_preview.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp index a8262b633..6901c68d4 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp @@ -505,7 +505,13 @@ void Generator::paintComposeArea() { _p->fillRect(_composeArea, st::historyReplyBg[_palette]); auto controlsTop = _composeArea.y() + _composeArea.height() - st::historySendSize.height(); - st::historyAttach.icon[_palette].paint(*_p, _composeArea.x() + st::historyAttach.iconPosition.x(), controlsTop + st::historyAttach.iconPosition.y(), _rect.width()); + const auto attachIconLeft = (st::historyAttach.iconPosition.x() < 0) + ? ((st::historyAttach.width - st::historyAttach.icon.width()) / 2) + : st::historyAttach.iconPosition.x(); + const auto attachIconTop = (st::historyAttach.iconPosition.y() < 0) + ? ((st::historyAttach.height - st::historyAttach.icon.height()) / 2) + : st::historyAttach.iconPosition.y(); + st::historyAttach.icon[_palette].paint(*_p, _composeArea.x() + attachIconLeft, controlsTop + attachIconTop, _rect.width()); auto right = st::historySendRight + st::historySendSize.width(); st::historyRecordVoice[_palette].paintInCenter(*_p, QRect(_composeArea.x() + _composeArea.width() - right, controlsTop, st::historySendSize.width(), st::historySendSize.height()));