mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Fixed triggering of pressed buttons in album preview.
This commit is contained in:
parent
948302cf02
commit
6975b04e6b
2 changed files with 12 additions and 1 deletions
|
@ -392,7 +392,7 @@ void AlbumPreview::mousePressEvent(QMouseEvent *e) {
|
||||||
cancelDrag();
|
cancelDrag();
|
||||||
if (const auto thumb = findThumb(position)) {
|
if (const auto thumb = findThumb(position)) {
|
||||||
if (thumb->buttonsContainPoint(e->pos())) {
|
if (thumb->buttonsContainPoint(e->pos())) {
|
||||||
thumbButtonsCallback(thumb, thumb->buttonTypeFromPoint(e->pos()));
|
_pressedButtonType = thumb->buttonTypeFromPoint(e->pos());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_paintedAbove = _suggestedThumb = _draggedThumb = thumb;
|
_paintedAbove = _suggestedThumb = _draggedThumb = thumb;
|
||||||
|
@ -492,7 +492,16 @@ void AlbumPreview::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
_draggedThumb = nullptr;
|
_draggedThumb = nullptr;
|
||||||
_suggestedThumb = nullptr;
|
_suggestedThumb = nullptr;
|
||||||
update();
|
update();
|
||||||
|
} else if (const auto thumb = findThumb(e->pos())) {
|
||||||
|
if (thumb->buttonsContainPoint(e->pos())) {
|
||||||
|
const auto was = _pressedButtonType;
|
||||||
|
const auto now = thumb->buttonTypeFromPoint(e->pos());
|
||||||
|
if (was == now) {
|
||||||
|
thumbButtonsCallback(thumb, now);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_pressedButtonType = AttachButtonType::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<int> AlbumPreview::thumbModified() const {
|
rpl::producer<int> AlbumPreview::thumbModified() const {
|
||||||
|
|
|
@ -89,6 +89,8 @@ private:
|
||||||
AlbumThumbnail *_paintedAbove = nullptr;
|
AlbumThumbnail *_paintedAbove = nullptr;
|
||||||
QPoint _draggedStartPosition;
|
QPoint _draggedStartPosition;
|
||||||
|
|
||||||
|
AttachButtonType _pressedButtonType = AttachButtonType::None;
|
||||||
|
|
||||||
rpl::event_stream<int> _thumbDeleted;
|
rpl::event_stream<int> _thumbDeleted;
|
||||||
rpl::event_stream<int> _thumbChanged;
|
rpl::event_stream<int> _thumbChanged;
|
||||||
rpl::event_stream<int> _thumbModified;
|
rpl::event_stream<int> _thumbModified;
|
||||||
|
|
Loading…
Add table
Reference in a new issue