mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 02:04:45 +00:00
better layout with multiple applets
This commit is contained in:
parent
ffa4137cd0
commit
f9f28f75ed
1 changed files with 9 additions and 5 deletions
|
|
@ -65,7 +65,8 @@ Item {
|
||||||
container.animationsEnabled = false;
|
container.animationsEnabled = false;
|
||||||
|
|
||||||
if (appletsSpace.lastSpacer.parent === appletsSpace.layout) {
|
if (appletsSpace.lastSpacer.parent === appletsSpace.layout) {
|
||||||
before = appletsSpace.lastSpacer;
|
//Uncomment to make the spacer the last element again
|
||||||
|
// before = appletsSpace.lastSpacer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (before) {
|
if (before) {
|
||||||
|
|
@ -172,13 +173,13 @@ Item {
|
||||||
|
|
||||||
onFlickingChanged: {
|
onFlickingChanged: {
|
||||||
if (!draggingVertically && contentY < -headerItem.height + root.height) {
|
if (!draggingVertically && contentY < -headerItem.height + root.height) {
|
||||||
scrollAnim.to = Math.round(contentY/root.height) * root.height
|
scrollAnim.to = Math.round(contentY/root.height) * root.height - headerItem.margin
|
||||||
scrollAnim.running = true;
|
scrollAnim.running = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onDraggingVerticallyChanged: {
|
onDraggingVerticallyChanged: {
|
||||||
if (!draggingVertically && contentY < -headerItem.height + root.height) {
|
if (!draggingVertically && contentY < -headerItem.height + root.height) {
|
||||||
scrollAnim.to = Math.round(contentY/root.height) * root.height
|
scrollAnim.to = Math.round(contentY/root.height) * root.height - headerItem.margin
|
||||||
scrollAnim.running = true;
|
scrollAnim.running = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +198,8 @@ Item {
|
||||||
property Item layout: appletsLayout
|
property Item layout: appletsLayout
|
||||||
property Item lastSpacer: spacer
|
property Item lastSpacer: spacer
|
||||||
width: root.width
|
width: root.width
|
||||||
height: mainLayout.Layout.minimumHeight
|
height: mainLayout.Layout.minimumHeight + stripe.height + units.gridUnit
|
||||||
|
property int margin: stripe.height + units.gridUnit * 2
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
plasmoid.action("configure").trigger();
|
plasmoid.action("configure").trigger();
|
||||||
|
|
@ -233,11 +235,13 @@ Item {
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: appletsLayout
|
id: appletsLayout
|
||||||
Layout.minimumHeight: Math.max(root.height, Math.round(Layout.preferredHeight / root.height) * root.height)
|
//Layout.minimumHeight: Math.max(root.height, Math.round(Layout.preferredHeight / root.height) * root.height)
|
||||||
Item {
|
Item {
|
||||||
id: spacer
|
id: spacer
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
Layout.minimumHeight: plasmoid.applets.length % 2 == 0 ? 0 : root.height/2
|
||||||
|
Layout.maximumHeight: Layout.minimumHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue