mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Increased clickable area to change forward options in sections.
This commit is contained in:
parent
7ffb341597
commit
787ed443f4
2 changed files with 17 additions and 9 deletions
|
@ -4329,12 +4329,14 @@ void HistoryWidget::mouseMoveEvent(QMouseEvent *e) {
|
|||
}
|
||||
|
||||
void HistoryWidget::updateOverStates(QPoint pos) {
|
||||
const auto isReadyToForward = readyToForward();
|
||||
const auto skip = isReadyToForward ? 0 : st::historyReplySkip;
|
||||
const auto replyEditForwardInfoRect = QRect(
|
||||
st::historyReplySkip,
|
||||
skip,
|
||||
_field->y() - st::historySendPadding - st::historyReplyHeight,
|
||||
width() - st::historyReplySkip - _fieldBarCancel->width(),
|
||||
width() - skip - _fieldBarCancel->width(),
|
||||
st::historyReplyHeight);
|
||||
auto inReplyEditForward = (_editMsgId || replyToId() || readyToForward())
|
||||
auto inReplyEditForward = (_editMsgId || replyToId() || isReadyToForward)
|
||||
&& replyEditForwardInfoRect.contains(pos);
|
||||
auto inPhotoEdit = inReplyEditForward
|
||||
&& _photoEditMedia
|
||||
|
@ -6170,16 +6172,19 @@ bool HistoryWidget::cornerButtonsHas(HistoryView::CornerButtonType type) {
|
|||
}
|
||||
|
||||
void HistoryWidget::mousePressEvent(QMouseEvent *e) {
|
||||
const auto isReadyToForward = readyToForward();
|
||||
const auto hasSecondLayer = (_editMsgId
|
||||
|| _replyToId
|
||||
|| readyToForward()
|
||||
|| isReadyToForward
|
||||
|| _kbReplyTo);
|
||||
_replyForwardPressed = hasSecondLayer && QRect(
|
||||
0,
|
||||
_field->y() - st::historySendPadding - st::historyReplyHeight,
|
||||
st::historyReplySkip,
|
||||
st::historyReplyHeight).contains(e->pos());
|
||||
if (_replyForwardPressed && !_fieldBarCancel->isHidden()) {
|
||||
if (_replyForwardPressed
|
||||
&& !_fieldBarCancel->isHidden()
|
||||
&& !isReadyToForward) {
|
||||
updateField();
|
||||
} else if (_inPhotoEdit && _photoEditMedia) {
|
||||
EditCaptionBox::StartPhotoEdit(
|
||||
|
@ -6189,7 +6194,7 @@ void HistoryWidget::mousePressEvent(QMouseEvent *e) {
|
|||
_field->getTextWithTags(),
|
||||
crl::guard(_list, [=] { cancelEdit(); }));
|
||||
} else if (_inReplyEditForward) {
|
||||
if (readyToForward()) {
|
||||
if (isReadyToForward) {
|
||||
_forwardPanel->editOptions(controller()->uiShow());
|
||||
} else {
|
||||
controller()->showPeerHistory(
|
||||
|
|
|
@ -612,7 +612,7 @@ void FieldHeader::init() {
|
|||
const auto isLeftIcon = (pos.x() < st::historyReplySkip);
|
||||
const auto isLeftButton = (e->button() == Qt::LeftButton);
|
||||
if (type == QEvent::MouseButtonPress) {
|
||||
if (isLeftButton && isLeftIcon) {
|
||||
if (isLeftButton && isLeftIcon && !inPreviewRect) {
|
||||
*leftIconPressed = true;
|
||||
update();
|
||||
} else if (isLeftButton && inPhotoEdit) {
|
||||
|
@ -966,11 +966,13 @@ MsgId FieldHeader::getDraftMessageId() const {
|
|||
}
|
||||
|
||||
void FieldHeader::updateControlsGeometry(QSize size) {
|
||||
const auto isReadyToForward = readyToForward();
|
||||
const auto skip = isReadyToForward ? 0 : st::historyReplySkip;
|
||||
_cancel->moveToRight(0, 0);
|
||||
_clickableRect = QRect(
|
||||
st::historyReplySkip,
|
||||
skip,
|
||||
0,
|
||||
width() - st::historyReplySkip - _cancel->width(),
|
||||
width() - skip - _cancel->width(),
|
||||
height());
|
||||
_shownMessagePreviewRect = QRect(
|
||||
st::historyReplySkip,
|
||||
|
@ -1000,6 +1002,7 @@ void FieldHeader::updateForwarding(
|
|||
if (readyToForward()) {
|
||||
replyToMessage({});
|
||||
}
|
||||
updateControlsGeometry(size());
|
||||
}
|
||||
|
||||
rpl::producer<FullMsgId> FieldHeader::editMsgIdValue() const {
|
||||
|
|
Loading…
Add table
Reference in a new issue