shell: the overview swipes sideways, and stops rejecting its own buffer
Two faults in the first cut. cacheBuffer was height * 2, and height is -1 until the first layout pass, so ListView refused it outright and said so on every open. Clamped at zero. The strip was vertical. TASK-14 asks for "horizontally swiped live app cards" and the reference shell's carousel says the same thing in its own comment — the whole strip slides in horizontally. On a phone the thumb travels sideways, and a vertical list fights the flick-up that dismisses a card, so the two gestures were competing for the same axis. Horizontal with snap-one-item, cards filling the viewport.
This commit is contained in:
parent
fdb0acfdce
commit
8c41f45420
1 changed files with 16 additions and 7 deletions
|
|
@ -63,11 +63,22 @@ Item {
|
|||
anchors.margins: 12
|
||||
visible: root.count > 0
|
||||
model: root.windows
|
||||
// Horizontal, per TASK-14 ("horizontally swiped live app cards") and
|
||||
// per the reference shell's own carousel, whose comment reads "the
|
||||
// whole strip slides in horizontally". A vertical strip was the first
|
||||
// draft and it is the wrong axis on a phone: the thumb travels
|
||||
// sideways, and a vertical list fights the flick-up that dismisses.
|
||||
orientation: ListView.Horizontal
|
||||
snapMode: ListView.SnapOneItem
|
||||
highlightRangeMode: ListView.StrictlyEnforceRange
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: width
|
||||
spacing: 12
|
||||
clip: true
|
||||
// Cards are tall; a phone shows one and a bit at a time and flicks
|
||||
// between them.
|
||||
cacheBuffer: height * 2
|
||||
// between them. Clamped at zero because `height` is -1 until the first
|
||||
// layout pass and ListView rejects a negative buffer outright.
|
||||
cacheBuffer: Math.max(0, width * 2)
|
||||
|
||||
delegate: Item {
|
||||
id: card
|
||||
|
|
@ -132,10 +143,7 @@ Item {
|
|||
}
|
||||
|
||||
width: list.width
|
||||
// 16:9 of the card's own width, plus the label strip. The reference
|
||||
// shell reserves 44 for its title; this uses the same idea with the
|
||||
// shell's own text metrics rather than a copied constant.
|
||||
height: Math.round(list.width * 0.62) + label.height + 8
|
||||
height: list.height
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
|
@ -153,7 +161,8 @@ Item {
|
|||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 6
|
||||
height: card.height - label.height - 14
|
||||
anchors.bottom: label.top
|
||||
anchors.bottomMargin: 6
|
||||
// Only while the overview is up. A live capture per window is
|
||||
// a render of that window every frame, and leaving them running
|
||||
// behind a closed overview is the battery cost of drawing
|
||||
|
|
|
|||
Loading…
Reference in a new issue