mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 14:43:09 +00:00
better looking shadow
This commit is contained in:
parent
2dbb5e7d83
commit
5a4fdc5a40
2 changed files with 51 additions and 12 deletions
|
|
@ -32,10 +32,9 @@ NanoShell.FullScreenOverlay {
|
||||||
property bool userInteracting: false
|
property bool userInteracting: false
|
||||||
readonly property bool wideScreen: width > units.gridUnit * 45
|
readonly property bool wideScreen: width > units.gridUnit * 45
|
||||||
readonly property int drawerWidth: wideScreen ? units.gridUnit * 25 : width
|
readonly property int drawerWidth: wideScreen ? units.gridUnit * 25 : width
|
||||||
readonly property int drawerHeight: contentArea.height + headerHeight
|
|
||||||
property int drawerX: 0
|
property int drawerX: 0
|
||||||
|
|
||||||
color: Qt.rgba(0, 0, 0, 0.6 * Math.min(1, offset/drawerHeight))
|
color: "transparent"//Qt.rgba(0, 0, 0, 0.6 * Math.min(1, offset/contentArea.height))
|
||||||
property alias contentItem: contentArea.contentItem
|
property alias contentItem: contentArea.contentItem
|
||||||
property int headerHeight
|
property int headerHeight
|
||||||
|
|
||||||
|
|
@ -51,7 +50,6 @@ NanoShell.FullScreenOverlay {
|
||||||
closeAnim.running = true;
|
closeAnim.running = true;
|
||||||
}
|
}
|
||||||
function updateState() {
|
function updateState() {
|
||||||
print("SUKUNNU"+offset + " "+openThreshold)
|
|
||||||
if (offset < openThreshold) {
|
if (offset < openThreshold) {
|
||||||
close();
|
close();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -75,6 +73,7 @@ NanoShell.FullScreenOverlay {
|
||||||
window.requestActivate();
|
window.requestActivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: closeAnim
|
id: closeAnim
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
|
|
@ -98,27 +97,68 @@ NanoShell.FullScreenOverlay {
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
properties: "offset"
|
properties: "offset"
|
||||||
from: window.offset
|
from: window.offset
|
||||||
to: drawerHeight
|
to: contentArea.height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
topMargin: headerHeight
|
||||||
|
}
|
||||||
|
color: "black"
|
||||||
|
opacity: 0.6 * Math.min(1, offset/contentArea.height)
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
height: headerHeight
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.top
|
||||||
|
}
|
||||||
|
color: "black"
|
||||||
|
opacity: 0.2
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
height: units.smallSpacing
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop {
|
||||||
|
position: 1.0
|
||||||
|
color: Qt.rgba(0, 0, 0, 0.0)
|
||||||
|
}
|
||||||
|
GradientStop {
|
||||||
|
position: 0.5
|
||||||
|
color: Qt.rgba(0, 0, 0, 0.4)
|
||||||
|
}
|
||||||
|
GradientStop {
|
||||||
|
position: 1.0
|
||||||
|
color: "transparent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
PlasmaCore.ColorScope {
|
PlasmaCore.ColorScope {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: mainFlickable
|
id: mainFlickable
|
||||||
anchors.fill: parent
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
topMargin: headerHeight
|
||||||
|
}
|
||||||
Binding {
|
Binding {
|
||||||
target: mainFlickable
|
target: mainFlickable
|
||||||
property: "contentY"
|
property: "contentY"
|
||||||
value: -window.offset + drawerHeight
|
value: -window.offset + contentArea.height
|
||||||
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: {
|
onContentYChanged: {
|
||||||
window.offset = -contentY + drawerHeight
|
window.offset = -contentY + contentArea.height
|
||||||
/* if (contentY > drawerHeight) {
|
|
||||||
contentY = d;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
contentWidth: window.width
|
contentWidth: window.width
|
||||||
contentHeight: window.height*2
|
contentHeight: window.height*2
|
||||||
|
|
@ -140,7 +180,6 @@ NanoShell.FullScreenOverlay {
|
||||||
onClicked: window.close();
|
onClicked: window.close();
|
||||||
PlasmaComponents.Control {
|
PlasmaComponents.Control {
|
||||||
id: contentArea
|
id: contentArea
|
||||||
y: headerHeight
|
|
||||||
x: drawerX
|
x: drawerX
|
||||||
width: drawerWidth
|
width: drawerWidth
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ PlasmaCore.ColorScope {
|
||||||
slidingPanel.drawerX = Math.min(Math.max(0, mouse.x - slidingPanel.drawerWidth/2), slidingPanel.width - slidingPanel.drawerWidth)
|
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.offset = units.gridUnit * 2;
|
slidingPanel.offset = 0//units.gridUnit * 2;
|
||||||
slidingPanel.showFullScreen();
|
slidingPanel.showFullScreen();
|
||||||
}
|
}
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue