mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 02:34:45 +00:00
smaller top drawer in tablet mode
This commit is contained in:
parent
5717c71a82
commit
035e7c4535
2 changed files with 51 additions and 52 deletions
|
|
@ -30,6 +30,9 @@ NanoShell.FullScreenPanel {
|
||||||
property int peekHeight
|
property int peekHeight
|
||||||
property bool userInteracting: false
|
property bool userInteracting: false
|
||||||
property bool expanded: false
|
property bool expanded: false
|
||||||
|
readonly property bool wideScreen: width > units.gridUnit * 45
|
||||||
|
readonly property int drawerWidth: wideScreen ? units.gridUnit * 25 : width
|
||||||
|
property int drawerX: 0
|
||||||
|
|
||||||
color: Qt.rgba(0, 0, 0, 0.6 * Math.min(1, offset/contentArea.height))
|
color: Qt.rgba(0, 0, 0, 0.6 * Math.min(1, offset/contentArea.height))
|
||||||
property alias contents: contentArea.data
|
property alias contents: contentArea.data
|
||||||
|
|
@ -117,13 +120,11 @@ NanoShell.FullScreenPanel {
|
||||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors {
|
x: drawerX
|
||||||
top: parent.top
|
anchors.top: parent.top
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
height: contentArea.height - mainFlickable.contentY
|
height: contentArea.height - mainFlickable.contentY
|
||||||
color: PlasmaCore.ColorScope.backgroundColor
|
color: PlasmaCore.ColorScope.backgroundColor
|
||||||
|
width: drawerWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
|
|
@ -156,8 +157,15 @@ NanoShell.FullScreenPanel {
|
||||||
window.userInteracting = true;
|
window.userInteracting = true;
|
||||||
window.updateState();
|
window.updateState();
|
||||||
}
|
}
|
||||||
|
MouseArea {
|
||||||
|
width: parent.width
|
||||||
|
height: mainItem.height
|
||||||
|
onClicked: window.close();
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: window.width
|
id: mainItem
|
||||||
|
x: drawerX
|
||||||
|
width: drawerWidth
|
||||||
height: Math.max(contentArea.height, window.height*2)
|
height: Math.max(contentArea.height, window.height*2)
|
||||||
Item {
|
Item {
|
||||||
id: contentArea
|
id: contentArea
|
||||||
|
|
@ -194,24 +202,14 @@ NanoShell.FullScreenPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea {
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
top: contentArea.bottom
|
|
||||||
}
|
|
||||||
height: window.height
|
|
||||||
onClicked: window.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
id: fixedArea
|
id: fixedArea
|
||||||
anchors {
|
anchors.top: parent.top
|
||||||
left: parent.left
|
x: drawerX
|
||||||
right: parent.right
|
width: drawerWidth
|
||||||
top: parent.top
|
|
||||||
}
|
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
z: 1
|
z: 1
|
||||||
parent: slidingPanel.visible ? panelContents : root
|
parent: slidingPanel.visible && !slidingPanel.wideScreen ? panelContents : root
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
|
@ -173,9 +173,10 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onPressed: {
|
onPressed: {
|
||||||
|
slidingPanel.drawerX = Math.min(Math.max(0, mouse.x - slidingPanel.drawerWidth/2), slidingPanel.width - slidingPanel.drawerWidth)
|
||||||
slidingPanel.userInteracting = true;
|
slidingPanel.userInteracting = true;
|
||||||
oldMouseY = mouse.y;
|
oldMouseY = mouse.y;
|
||||||
slidingPanel.visible = true;
|
slidingPanel.showFullScreen();
|
||||||
}
|
}
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
//var factor = (mouse.y - oldMouseY > 0) ? (1 - Math.max(0, (slidingArea.y + slidingPanel.overShoot) / slidingPanel.overShoot)) : 1
|
//var factor = (mouse.y - oldMouseY > 0) ? (1 - Math.max(0, (slidingArea.y + slidingPanel.overShoot) / slidingPanel.overShoot)) : 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue