mirror of https://github.com/procxx/kepka.git
				
				
				
			Fix drag by date of grouped media.
This commit is contained in:
		
							parent
							
								
									3a56b7cabd
								
							
						
					
					
						commit
						520a644150
					
				| 
						 | 
					@ -1024,7 +1024,7 @@ void HistoryInner::performDrag() {
 | 
				
			||||||
				forwardMimeType = qsl("application/x-td-forward-pressed");
 | 
									forwardMimeType = qsl("application/x-td-forward-pressed");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (const auto pressedLnkItem = _dragStateItem) {
 | 
							if (const auto pressedLnkItem = _mouseActionItem) {
 | 
				
			||||||
			if ((pressedMedia = pressedLnkItem->getMedia())) {
 | 
								if ((pressedMedia = pressedLnkItem->getMedia())) {
 | 
				
			||||||
				if (forwardMimeType.isEmpty() && pressedMedia->dragItemByHandler(pressedHandler)) {
 | 
									if (forwardMimeType.isEmpty() && pressedMedia->dragItemByHandler(pressedHandler)) {
 | 
				
			||||||
					forwardMimeType = qsl("application/x-td-forward-pressed-link");
 | 
										forwardMimeType = qsl("application/x-td-forward-pressed-link");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -205,7 +205,7 @@ void HistoryGroupedMedia::draw(
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HistoryTextState HistoryGroupedMedia::getState(
 | 
					HistoryTextState HistoryGroupedMedia::getElementState(
 | 
				
			||||||
		QPoint point,
 | 
							QPoint point,
 | 
				
			||||||
		HistoryStateRequest request) const {
 | 
							HistoryStateRequest request) const {
 | 
				
			||||||
	for (const auto &element : _elements) {
 | 
						for (const auto &element : _elements) {
 | 
				
			||||||
| 
						 | 
					@ -218,7 +218,14 @@ HistoryTextState HistoryGroupedMedia::getState(
 | 
				
			||||||
			return result;
 | 
								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 captionw = _width - st::msgPadding.left() - st::msgPadding.right();
 | 
				
			||||||
		const auto captiony = _height
 | 
							const auto captiony = _height
 | 
				
			||||||
			- (isBubbleBottom() ? st::msgPadding.bottom() : 0)
 | 
								- (isBubbleBottom() ? st::msgPadding.bottom() : 0)
 | 
				
			||||||
| 
						 | 
					@ -229,9 +236,7 @@ HistoryTextState HistoryGroupedMedia::getState(
 | 
				
			||||||
				captionw,
 | 
									captionw,
 | 
				
			||||||
				request.forText()));
 | 
									request.forText()));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						} else if (_parent->getMedia() == this) {
 | 
				
			||||||
	auto result = HistoryTextState(_parent);
 | 
					 | 
				
			||||||
	if (_caption.isEmpty() && _parent->getMedia() == this) {
 | 
					 | 
				
			||||||
		auto fullRight = _width;
 | 
							auto fullRight = _width;
 | 
				
			||||||
		auto fullBottom = _height;
 | 
							auto fullBottom = _height;
 | 
				
			||||||
		if (_parent->pointInTime(fullRight, fullBottom, point, InfoDisplayOverImage)) {
 | 
							if (_parent->pointInTime(fullRight, fullBottom, point, InfoDisplayOverImage)) {
 | 
				
			||||||
| 
						 | 
					@ -245,7 +250,7 @@ HistoryTextState HistoryGroupedMedia::getState(
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return HistoryTextState();
 | 
						return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool HistoryGroupedMedia::toggleSelectionByHandlerClick(
 | 
					bool HistoryGroupedMedia::toggleSelectionByHandlerClick(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -128,6 +128,9 @@ private:
 | 
				
			||||||
	not_null<HistoryMedia*> main() const;
 | 
						not_null<HistoryMedia*> main() const;
 | 
				
			||||||
	bool validateGroupElements(
 | 
						bool validateGroupElements(
 | 
				
			||||||
		const std::vector<not_null<HistoryItem*>> &others) const;
 | 
							const std::vector<not_null<HistoryItem*>> &others) const;
 | 
				
			||||||
 | 
						HistoryTextState getElementState(
 | 
				
			||||||
 | 
							QPoint point,
 | 
				
			||||||
 | 
							HistoryStateRequest request) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Text _caption;
 | 
						Text _caption;
 | 
				
			||||||
	std::vector<Element> _elements;
 | 
						std::vector<Element> _elements;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue