some layout fixes

This commit is contained in:
Marco Martin 2015-05-15 18:26:06 +02:00
parent adc4603274
commit 5179b04a68
2 changed files with 27 additions and 10 deletions

View file

@ -27,7 +27,7 @@ MouseArea {
id: notificationItem id: notificationItem
height: units.gridUnit * (expanded ? (actionsLayout.visible ? 6 : 4) : 2) + background.margins.top + background.margins.bottom height: Math.max(summaryText.height, icon.height) + background.margins.top + background.margins.bottom + (expanded ? actionsLayout.height : 0)
width: parent.width width: parent.width
anchors.bottomMargin: 10 anchors.bottomMargin: 10
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
@ -38,11 +38,17 @@ MouseArea {
property var actions: model.actions property var actions: model.actions
Behavior on x { Behavior on x {
SpringAnimation { spring: 2; damping: 0.2 } NumberAnimation {
easing.type: Easing.InOutQuad
duration: units.longDuration
}
} }
Behavior on height { Behavior on height {
SpringAnimation { spring: 5; damping: 0.3 } NumberAnimation {
easing.type: Easing.InOutQuad
duration: units.longDuration
}
} }
onReleased: { onReleased: {
@ -50,8 +56,10 @@ MouseArea {
if (x > width / 4 || x < width / -4) { if (x > width / 4 || x < width / -4) {
//if there is an action, execute the first when swiping left //if there is an action, execute the first when swiping left
if (x < 0 && actions) { if (x < 0 && actions) {
var action = actions.get(0) var action = actions.get(0);
root.executeAction(source, action.id) if (action) {
root.executeAction(source, action.id)
}
} }
notificationsModel.remove(index); notificationsModel.remove(index);
} else { } else {

View file

@ -157,7 +157,8 @@ Item {
NumberAnimation { NumberAnimation {
properties: "x" properties: "x"
from: notificationView.width from: notificationView.width
duration: 100 duration: units.shortDuration
easing.type: Easing.InOutQuad
} }
} }
@ -165,19 +166,27 @@ Item {
NumberAnimation { NumberAnimation {
properties: "x" properties: "x"
to: notificationView.width to: notificationView.width
duration: 500 duration: units.longDuration
easing.type: Easing.InOutQuad
} }
NumberAnimation { NumberAnimation {
properties: "opacity" properties: "opacity"
to: 0 to: 0
duration: 500 duration: units.longDuration
easing.type: Easing.InOutQuad
} }
} }
removeDisplaced: Transition { removeDisplaced: Transition {
SequentialAnimation { SequentialAnimation {
PauseAnimation { duration: 600 } PauseAnimation {
NumberAnimation { properties: "x,y"; duration: 100 } duration: units.longDuration
}
NumberAnimation {
properties: "x,y"
duration: units.shortDuration
easing.type: Easing.InOutQuad
}
} }
} }