mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-27 14:33:08 +00:00
fix the swipe out gesture
This commit is contained in:
parent
d3b41afc02
commit
2a0152bad0
1 changed files with 84 additions and 88 deletions
|
|
@ -38,102 +38,100 @@ Rectangle {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: removeAnim.running = true;
|
drag.filterChildren: true
|
||||||
}
|
drag.target: splitDrawer.open ? null : main
|
||||||
|
drag.axis: Drag.XAxis
|
||||||
|
drag.maximumX: 0
|
||||||
|
onReleased: {
|
||||||
|
if (main.x < -main.width/3) {
|
||||||
|
removeAnim.running = true;
|
||||||
|
} else {
|
||||||
|
openAnim.running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NumberAnimation {
|
|
||||||
id: openAnim
|
|
||||||
running: true
|
|
||||||
target: main
|
|
||||||
properties: "x"
|
|
||||||
duration: units.longDuration
|
|
||||||
easing.type: Easing.InOutQuad
|
|
||||||
to: 0
|
|
||||||
}
|
|
||||||
SequentialAnimation {
|
|
||||||
id: removeAnim
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
id: openAnim
|
||||||
|
running: true
|
||||||
target: main
|
target: main
|
||||||
properties: "x"
|
properties: "x"
|
||||||
duration: units.longDuration
|
duration: units.longDuration
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
to: -main.width
|
to: 0
|
||||||
}
|
}
|
||||||
ScriptAction {
|
SequentialAnimation {
|
||||||
script: root.closed();
|
id: removeAnim
|
||||||
}
|
NumberAnimation {
|
||||||
}
|
target: main
|
||||||
Rectangle {
|
properties: "x"
|
||||||
id: main
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
x: -width
|
to: -main.width
|
||||||
width: parent.width - parent.width/6
|
}
|
||||||
height: parent.height
|
ScriptAction {
|
||||||
color: theme.backgroundColor
|
script: root.closed();
|
||||||
|
|
||||||
opacity: 1 - Math.abs(x / (width/2))
|
|
||||||
property alias containment: widgetExplorer.containment
|
|
||||||
|
|
||||||
//external drop events can cause a raise event causing us to lose focus and
|
|
||||||
//therefore get deleted whilst we are still in a drag exec()
|
|
||||||
//this is a clue to the owning dialog that hideOnWindowDeactivate should be deleted
|
|
||||||
//See https://bugs.kde.org/show_bug.cgi?id=332733
|
|
||||||
property bool preventWindowHide: false
|
|
||||||
|
|
||||||
property Item getWidgetsButton
|
|
||||||
property Item categoryButton
|
|
||||||
|
|
||||||
|
|
||||||
function addCurrentApplet() {
|
|
||||||
var pluginName = list.currentItem ? list.currentItem.pluginName : ""
|
|
||||||
if (pluginName) {
|
|
||||||
widgetExplorer.addApplet(pluginName)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: main
|
||||||
|
|
||||||
|
x: -width
|
||||||
|
width: parent.width - parent.width/6
|
||||||
|
height: parent.height
|
||||||
|
color: theme.backgroundColor
|
||||||
|
|
||||||
|
opacity: 1 - Math.abs(x / (width/2))
|
||||||
|
property alias containment: widgetExplorer.containment
|
||||||
|
|
||||||
|
//external drop events can cause a raise event causing us to lose focus and
|
||||||
|
//therefore get deleted whilst we are still in a drag exec()
|
||||||
|
//this is a clue to the owning dialog that hideOnWindowDeactivate should be deleted
|
||||||
|
//See https://bugs.kde.org/show_bug.cgi?id=332733
|
||||||
|
property bool preventWindowHide: false
|
||||||
|
|
||||||
|
property Item getWidgetsButton
|
||||||
|
property Item categoryButton
|
||||||
|
|
||||||
|
|
||||||
WidgetExplorer {
|
function addCurrentApplet() {
|
||||||
id: widgetExplorer
|
var pluginName = list.currentItem ? list.currentItem.pluginName : ""
|
||||||
//view: desktop
|
if (pluginName) {
|
||||||
onShouldClose: removeAnim.running = true;
|
widgetExplorer.addApplet(pluginName)
|
||||||
}
|
|
||||||
MobileComponents.SplitDrawer {
|
|
||||||
visible: true
|
|
||||||
anchors.fill: parent
|
|
||||||
drawer: PlasmaExtras.ScrollArea {
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
model: widgetExplorer.filterModel
|
|
||||||
delegate: PlasmaComponents.ListItem {
|
|
||||||
enabled: true
|
|
||||||
visible: !model.separator
|
|
||||||
height: model.separator ? 0 : implicitHeight
|
|
||||||
PlasmaComponents.Label {
|
|
||||||
text: model.display
|
|
||||||
}
|
|
||||||
onClicked: {
|
|
||||||
list.contentX = 0
|
|
||||||
list.contentY = 0
|
|
||||||
heading.text = model.display
|
|
||||||
widgetExplorer.widgetsModel.filterQuery = model.filterData
|
|
||||||
widgetExplorer.widgetsModel.filterType = model.filterType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea {
|
|
||||||
|
|
||||||
|
WidgetExplorer {
|
||||||
|
id: widgetExplorer
|
||||||
|
//view: desktop
|
||||||
|
onShouldClose: removeAnim.running = true;
|
||||||
|
}
|
||||||
|
MobileComponents.SplitDrawer {
|
||||||
|
id: splitDrawer
|
||||||
|
visible: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
drag.filterChildren: true
|
drawer: PlasmaExtras.ScrollArea {
|
||||||
drag.target: main
|
|
||||||
drag.axis: Drag.XAxis
|
ListView {
|
||||||
drag.maximumX: 0
|
model: widgetExplorer.filterModel
|
||||||
onReleased: {
|
delegate: PlasmaComponents.ListItem {
|
||||||
if (main.x < -main.width/2) {
|
enabled: true
|
||||||
removeAnim.running = true;
|
visible: !model.separator
|
||||||
} else {
|
height: model.separator ? 0 : implicitHeight
|
||||||
openAnim.running = true;
|
PlasmaComponents.Label {
|
||||||
|
text: model.display
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
list.contentX = 0
|
||||||
|
list.contentY = 0
|
||||||
|
heading.text = model.display
|
||||||
|
widgetExplorer.widgetsModel.filterQuery = model.filterData
|
||||||
|
widgetExplorer.widgetsModel.filterType = model.filterType
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
GridLayout {
|
GridLayout {
|
||||||
|
|
@ -269,12 +267,10 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
}
|
main.getWidgetsButton = getWidgetsButton
|
||||||
Component.onCompleted: {
|
main.categoryButton = categoryButton
|
||||||
main.getWidgetsButton = getWidgetsButton
|
}
|
||||||
main.categoryButton = categoryButton
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue