mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix adding from "Emoji from this message".
This commit is contained in:
parent
971803803c
commit
9957678fb7
1 changed files with 26 additions and 10 deletions
|
@ -652,8 +652,8 @@ void StickersBox::prepare() {
|
||||||
}
|
}
|
||||||
if (const auto featured = _featured.widget()) {
|
if (const auto featured = _featured.widget()) {
|
||||||
featured->setInstallSetCallback([=](uint64 setId) {
|
featured->setInstallSetCallback([=](uint64 setId) {
|
||||||
markAsInstalledCallback(setId);
|
|
||||||
installCallback(setId);
|
installCallback(setId);
|
||||||
|
markAsInstalledCallback(setId);
|
||||||
});
|
});
|
||||||
featured->setRemoveSetCallback(markAsRemovedCallback);
|
featured->setRemoveSetCallback(markAsRemovedCallback);
|
||||||
}
|
}
|
||||||
|
@ -1905,9 +1905,19 @@ void StickersBox::Inner::updateSelected() {
|
||||||
selected = selectedIndex;
|
selected = selectedIndex;
|
||||||
local.setY(local.y() - _itemsTop - selectedIndex * _rowHeight);
|
local.setY(local.y() - _itemsTop - selectedIndex * _rowHeight);
|
||||||
const auto row = _rows[selectedIndex].get();
|
const auto row = _rows[selectedIndex].get();
|
||||||
if (!_megagroupSet && (_isInstalledTab || (_section == Section::Featured) || !row->isInstalled() || row->isArchived() || row->removed)) {
|
if (!_megagroupSet
|
||||||
|
&& (_isInstalledTab
|
||||||
|
|| (_section == Section::Featured)
|
||||||
|
|| !row->isInstalled()
|
||||||
|
|| row->isArchived()
|
||||||
|
|| row->removed)) {
|
||||||
auto removeButton = (_isInstalledTab && !row->removed);
|
auto removeButton = (_isInstalledTab && !row->removed);
|
||||||
auto rect = myrtlrect(relativeButtonRect(removeButton, false));
|
|
||||||
|
const auto installedSetButton = !_isInstalledTab
|
||||||
|
&& row->isInstalled()
|
||||||
|
&& !row->isArchived()
|
||||||
|
&& !row->removed;
|
||||||
|
auto rect = myrtlrect(relativeButtonRect(removeButton, installedSetButton));
|
||||||
actionSel = rect.contains(local) ? selectedIndex : -1;
|
actionSel = rect.contains(local) ? selectedIndex : -1;
|
||||||
} else {
|
} else {
|
||||||
actionSel = -1;
|
actionSel = -1;
|
||||||
|
@ -1960,12 +1970,19 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
|
|
||||||
_mouse = e->globalPos();
|
_mouse = e->globalPos();
|
||||||
updateSelected();
|
updateSelected();
|
||||||
if (_actionDown == _actionSel && _actionSel >= 0) {
|
const auto down = _actionDown;
|
||||||
const auto callback = _rows[_actionDown]->removed
|
setActionDown(-1);
|
||||||
? _installSetCallback
|
if (down == _actionSel && _actionSel >= 0) {
|
||||||
: _removeSetCallback;
|
const auto row = _rows[down].get();
|
||||||
|
const auto installedSet = row->isInstalled()
|
||||||
|
&& !row->isArchived()
|
||||||
|
&& !row->removed;
|
||||||
|
const auto callback = installedSet
|
||||||
|
? _removeSetCallback
|
||||||
|
: _installSetCallback;
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(_rows[_actionDown]->set->id);
|
row->ripple.reset();
|
||||||
|
callback(row->set->id);
|
||||||
}
|
}
|
||||||
} else if (_dragging >= 0) {
|
} else if (_dragging >= 0) {
|
||||||
_rows[_dragging]->yadd.start(0.);
|
_rows[_dragging]->yadd.start(0.);
|
||||||
|
@ -1976,7 +1993,7 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_dragging = _started = -1;
|
_dragging = _started = -1;
|
||||||
} else if (pressed == _selected && _actionSel < 0 && _actionDown < 0) {
|
} else if (pressed == _selected && _actionSel < 0 && down < 0) {
|
||||||
const auto selectedIndex = [&] {
|
const auto selectedIndex = [&] {
|
||||||
if (auto index = std::get_if<int>(&_selected)) {
|
if (auto index = std::get_if<int>(&_selected)) {
|
||||||
return *index;
|
return *index;
|
||||||
|
@ -2000,7 +2017,6 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
showSetByRow(*_megagroupSelectedSet);
|
showSetByRow(*_megagroupSelectedSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setActionDown(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersBox::Inner::saveGroupSet(Fn<void()> done) {
|
void StickersBox::Inner::saveGroupSet(Fn<void()> done) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue