Kirigami issue
Dirk Hohndel
dirk at hohndel.org
Tue Apr 19 15:03:54 UTC 2016
With latest master of Kirigami we are observing an odd problem in Subsurface-mobile.
This happens in landscape mode (at least I haven't been able to reproduce this in portrait mode).
Our page stack has in position zero a vertical listview (dive list). If you select one of the dives in this listview, that opens a secondary listview in position one of the page stack, this one is horizontal.
If you swipe left or right to flip from dive to dive in that horizontal listview, syncIndexWithPosition gets called on the page stack with mapped.x(1024), actualRoot.currentItem.width(1024) and actualRoot.width(1024). This is where I don't quite understand how the code is supposed to work:
var mapped = actualRoot.currentItem.mapToItem(mainFlickable, 0, 0);
if (mapped.x >= 0 && mapped.x + actualRoot.currentItem.width <= actualRoot.width) {
return;
}
So the first test fails as mapped.x + currentItem.width is 2048 > width of 1024
what does that mean? what are we checking here for?
Then the code loops through the page stack to find an item that can be mapped on the screen - which always picks the first item in the page stack.
//search the last page to kinda fit
for (var i = Engine.pageStack.length - 1; i >= 0; --i) {
var item = Engine.pageStack[i];
var mapped = item.mapToItem(mainFlickable, 0, 0, item.width, item.height);
if (mapped.x < item.width /2 && (mapped.x+mapped.width) <= actualRoot.width) {
actualRoot.currentIndex = i;
break;
}
}
As a result, trying to move from one item to the next in the inner horizontal listview makes us jump back to page zero (which is the vertical outer listview).
So I tried to figure out why this happens in landscape mode and not in portrait mode... the difference that I could find is that in landscape mode for some reason we trigger the scrollEventCompressTimer but in portrait mode we don't ?!?
Adding a ton more print statements leads me to this:
in landscape mode we end up in the page stack's onContentXChanged handler (why?) with dragging = false. And that causes us to restart the scrollEventCompressTimer, even though we are scrolling only the inner listview and not the page stack. But in portrait mode we never trigger the page stack's onContentXChanged when swiping left and right between dives.
Does this make sense to anyone? Any idea how to fix this?
/D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160419/7af49abc/attachment-0001.html>
More information about the Plasma-devel
mailing list