Fix drag by date of grouped media.

This commit is contained in:
John Preston 2017-12-16 11:20:04 +04:00
parent 3a56b7cabd
commit 520a644150
3 changed files with 15 additions and 7 deletions

View File

@ -1024,7 +1024,7 @@ void HistoryInner::performDrag() {
forwardMimeType = qsl("application/x-td-forward-pressed");
}
}
if (const auto pressedLnkItem = _dragStateItem) {
if (const auto pressedLnkItem = _mouseActionItem) {
if ((pressedMedia = pressedLnkItem->getMedia())) {
if (forwardMimeType.isEmpty() && pressedMedia->dragItemByHandler(pressedHandler)) {
forwardMimeType = qsl("application/x-td-forward-pressed-link");

View File

@ -205,7 +205,7 @@ void HistoryGroupedMedia::draw(
}
}
HistoryTextState HistoryGroupedMedia::getState(
HistoryTextState HistoryGroupedMedia::getElementState(
QPoint point,
HistoryStateRequest request) const {
for (const auto &element : _elements) {
@ -218,7 +218,14 @@ HistoryTextState HistoryGroupedMedia::getState(
return result;
}
}
if (!_caption.isEmpty()) {
return HistoryTextState(_parent);
}
HistoryTextState HistoryGroupedMedia::getState(
QPoint point,
HistoryStateRequest request) const {
auto result = getElementState(point, request);
if (!result.link && !_caption.isEmpty()) {
const auto captionw = _width - st::msgPadding.left() - st::msgPadding.right();
const auto captiony = _height
- (isBubbleBottom() ? st::msgPadding.bottom() : 0)
@ -229,9 +236,7 @@ HistoryTextState HistoryGroupedMedia::getState(
captionw,
request.forText()));
}
}
auto result = HistoryTextState(_parent);
if (_caption.isEmpty() && _parent->getMedia() == this) {
} else if (_parent->getMedia() == this) {
auto fullRight = _width;
auto fullBottom = _height;
if (_parent->pointInTime(fullRight, fullBottom, point, InfoDisplayOverImage)) {
@ -245,7 +250,7 @@ HistoryTextState HistoryGroupedMedia::getState(
}
}
}
return HistoryTextState();
return result;
}
bool HistoryGroupedMedia::toggleSelectionByHandlerClick(

View File

@ -128,6 +128,9 @@ private:
not_null<HistoryMedia*> main() const;
bool validateGroupElements(
const std::vector<not_null<HistoryItem*>> &others) const;
HistoryTextState getElementState(
QPoint point,
HistoryStateRequest request) const;
Text _caption;
std::vector<Element> _elements;