mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed ability to create vertical drum picker with first chosen item.
This commit is contained in:
parent
b790847fde
commit
a704611705
2 changed files with 4 additions and 3 deletions
|
@ -82,9 +82,10 @@ VerticalDrumPicker::VerticalDrumPicker(
|
||||||
) | rpl::start_with_next([=](const QSize &s) {
|
) | rpl::start_with_next([=](const QSize &s) {
|
||||||
_itemsVisible.count = std::ceil(float64(s.height()) / _itemHeight);
|
_itemsVisible.count = std::ceil(float64(s.height()) / _itemHeight);
|
||||||
_itemsVisible.centerOffset = _itemsVisible.count / 2;
|
_itemsVisible.centerOffset = _itemsVisible.count / 2;
|
||||||
if (_pendingStartIndex && _itemsVisible.count) {
|
if ((_pendingStartIndex >= 0) && _itemsVisible.count) {
|
||||||
_index = normalizedIndex(base::take(_pendingStartIndex)
|
_index = normalizedIndex(_pendingStartIndex
|
||||||
- _itemsVisible.centerOffset);
|
- _itemsVisible.centerOffset);
|
||||||
|
_pendingStartIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_loopData.looped) {
|
if (!_loopData.looped) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ private:
|
||||||
|
|
||||||
PaintItemCallback _paintCallback;
|
PaintItemCallback _paintCallback;
|
||||||
|
|
||||||
int _pendingStartIndex = 0;
|
int _pendingStartIndex = -1;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue