on xenial help sign in
make snap decisions draggable/closable only when contracted
dc024cbLukáš Tinkl
qml/Notifications/Notification.qml+5−3
@@ -40,6 +40,7 @@ StyledItem {
40 property bool fullscreen: false
40 property bool fullscreen: false
41 property int maxHeight
41 property int maxHeight
42 property int margins: units.gu(1)
42 property int margins: units.gu(1)
43+ readonly property bool draggable: type !== Notification.SnapDecision || state === "contracted"
43
44
44 readonly property real defaultOpacity: 1.0
45 readonly property real defaultOpacity: 1.0
45 property bool hasMouse
46 property bool hasMouse
@@ -99,6 +100,7 @@ StyledItem {
99 }
100 }
100
101
101 Behavior on x {
102 Behavior on x {
103+ enabled: draggable
102 UbuntuNumberAnimation { easing.type: Easing.OutBounce }
104 UbuntuNumberAnimation { easing.type: Easing.OutBounce }
103 }
105 }
104
106
@@ -151,7 +153,7 @@ StyledItem {
151 }
153 }
152
154
153 onXChanged: {
155 onXChanged: {
154− if (Math.abs(notification.x) > 0.75 * notification.width) {
156+ if (draggable && Math.abs(notification.x) > 0.75 * notification.width) {
155 notification.notification.close()
157 notification.notification.close()
156 }
158 }
157 }
159 }
@@ -192,7 +194,7 @@ StyledItem {
192 anchors.fill: parent
194 anchors.fill: parent
193 objectName: "interactiveArea"
195 objectName: "interactiveArea"
194
196
195− drag.target: notification
197+ drag.target: draggable ? notification : undefined
196 drag.axis: Drag.XAxis
198 drag.axis: Drag.XAxis
197 drag.minimumX: -notification.width
199 drag.minimumX: -notification.width
198 drag.maximumX: notification.width
200 drag.maximumX: notification.width
@@ -219,7 +221,7 @@ StyledItem {
219 width: units.gu(2)
221 width: units.gu(2)
220 height: width
222 height: width
221 radius: width / 2
223 radius: width / 2
222− visible: hasMouse && (containsMouse || interactiveArea.containsMouse)
224+ visible: hasMouse && draggable && (containsMouse || interactiveArea.containsMouse)
223 iconName: "close"
225 iconName: "close"
224 outline: false
226 outline: false
225 color: theme.palette.normal.negative
227 color: theme.palette.normal.negative