Workaround for continued xChanged after window was hid.

This commit is contained in:
Hannah von Reth 2015-09-28 12:00:52 +02:00
parent f143a9aced
commit 57f117da29

View File

@ -6,6 +6,9 @@ Rectangle {
property int snoreBaseSize: body.font.pixelSize
Drag.active: mouseAreaAccept.drag.active
width: snoreBaseSize * 30
height: snoreBaseSize * 9
color: window.color
@ -23,16 +26,22 @@ Rectangle {
onXChanged: {
// There is a Qt bug which will not stop the mouse tracking if the
// item is hid during a drag event.
if(Drag.active){
window.x += x
var visibleWidth = window.isOrientatedLeft?
if(window.visible && Math.abs((window.isOrientatedLeft?
window.x - window.animationTo:
window.x - window.animationFrom
if(window.visible && Math.abs(visibleWidth + mouseAreaAccept.mouseX) <= width * 0.05){
window.x - window.animationFrom) + mouseAreaAccept.mouseX) <= width * 0.05){
Drag.cancel()
window.visible = false
window.dismissed()
}
} else {
x = 0
}
}
NumberAnimation{
id: animation
@ -48,7 +57,6 @@ Rectangle {
anchors.fill: parent
z: 90
onClicked: {
console.log("invoked")
window.invoked()
}
drag.target: parent