Fixed ability to create vertical drum picker with first chosen item.
This commit is contained in:
parent
b790847fde
commit
a704611705
|
@ -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…
Reference in New Issue