mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
better position management
This commit is contained in:
parent
56cb796dd5
commit
f6b68d853c
2 changed files with 15 additions and 7 deletions
|
|
@ -32,6 +32,7 @@ FullScreenPanel {
|
|||
|
||||
color: "transparent"
|
||||
property alias contents: contentArea.data
|
||||
property int headerHeight
|
||||
|
||||
width: Screen.width
|
||||
height: Screen.height
|
||||
|
|
@ -53,7 +54,11 @@ FullScreenPanel {
|
|||
openAnim.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: updateStateTimer
|
||||
interval: 0
|
||||
onTriggered: updateState()
|
||||
}
|
||||
onActiveChanged: {
|
||||
if (!active) {
|
||||
close();
|
||||
|
|
@ -89,7 +94,7 @@ FullScreenPanel {
|
|||
easing.type: Easing.InOutQuad
|
||||
properties: "offset"
|
||||
from: window.offset
|
||||
to: window.peekHeight
|
||||
to: window.peekHeight - headerHeight
|
||||
}
|
||||
PropertyAnimation {
|
||||
id: openAnim
|
||||
|
|
@ -127,11 +132,11 @@ FullScreenPanel {
|
|||
Binding {
|
||||
target: mainFlickable
|
||||
property: "contentY"
|
||||
value: -window.offset + contentArea.height
|
||||
value: -window.offset + contentArea.height - window.headerHeight
|
||||
when: !mainFlickable.moving && !mainFlickable.dragging && !mainFlickable.flicking
|
||||
}
|
||||
//no loop as those 2 values compute to exactly the same
|
||||
onContentYChanged: window.offset = -contentY + contentArea.height
|
||||
onContentYChanged: window.offset = -contentY + contentArea.height - window.headerHeight
|
||||
contentWidth: window.width
|
||||
contentHeight: window.height*2
|
||||
bottomMargin: window.height
|
||||
|
|
@ -139,7 +144,7 @@ FullScreenPanel {
|
|||
onFlickEnded: window.updateState();
|
||||
Item {
|
||||
width: window.width
|
||||
height: window.height*2
|
||||
height: Math.max(contentArea.height, window.height*2)
|
||||
Item {
|
||||
id: contentArea
|
||||
anchors {
|
||||
|
|
@ -147,6 +152,9 @@ FullScreenPanel {
|
|||
right: parent.right
|
||||
}
|
||||
height: children[0].implicitHeight
|
||||
onHeightChanged: {
|
||||
updateStateTimer.restart()
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
height: units.gridUnit
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ PlasmaCore.ColorScope {
|
|||
width: plasmoid.availableScreenRect.width
|
||||
height: plasmoid.availableScreenRect.height
|
||||
peekHeight: quickSettingsParent.height + notificationsParent.minimumHeight + root.height
|
||||
headerHeight: root.height
|
||||
contents: Item {
|
||||
id: panelContents
|
||||
anchors.fill: parent
|
||||
|
|
@ -226,7 +227,7 @@ PlasmaCore.ColorScope {
|
|||
height: units.devicePixelRatio
|
||||
color: PlasmaCore.ColorScope.textColor
|
||||
opacity: 0.2
|
||||
visible: slidingPanel.offset < panelContents.height
|
||||
visible: slidingPanel.offset + slidingPanel.headerHeight < panelContents.height
|
||||
}
|
||||
}
|
||||
Item {
|
||||
|
|
@ -240,7 +241,6 @@ PlasmaCore.ColorScope {
|
|||
property var applet
|
||||
height: applet ? applet.fullRepresentationItem.Layout.maximumHeight : 0
|
||||
property int minimumHeight: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0
|
||||
onHeightChanged: slidingPanel.updateState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue