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