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