mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +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) {
|
||||
_itemsVisible.count = std::ceil(float64(s.height()) / _itemHeight);
|
||||
_itemsVisible.centerOffset = _itemsVisible.count / 2;
|
||||
if (_pendingStartIndex && _itemsVisible.count) {
|
||||
_index = normalizedIndex(base::take(_pendingStartIndex)
|
||||
if ((_pendingStartIndex >= 0) && _itemsVisible.count) {
|
||||
_index = normalizedIndex(_pendingStartIndex
|
||||
- _itemsVisible.centerOffset);
|
||||
_pendingStartIndex = -1;
|
||||
}
|
||||
|
||||
if (!_loopData.looped) {
|
||||
|
|
|
@ -75,7 +75,7 @@ private:
|
|||
|
||||
PaintItemCallback _paintCallback;
|
||||
|
||||
int _pendingStartIndex = 0;
|
||||
int _pendingStartIndex = -1;
|
||||
|
||||
struct {
|
||||
int count = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue