on xenial help sign in
also save the distanceY for restoring the window dragged back from a maximized state
f803c90Lukáš Tinkl
qml/Stages/MoveHandler.qml+3−2
@@ -83,17 +83,18 @@ Item {
83 }
83 }
84
84
85 function handlePressedChanged(pressed, pressedButtons, mouseX, mouseY) {
85 function handlePressedChanged(pressed, pressedButtons, mouseX, mouseY) {
86− if (pressed && pressedButtons == Qt.LeftButton) {
86+ if (pressed && pressedButtons === Qt.LeftButton) {
87 var pos = mapToItem(target, mouseX, mouseY);
87 var pos = mapToItem(target, mouseX, mouseY);
88 if (target.anyMaximized) {
88 if (target.anyMaximized) {
89 // keep distanceX relative to the normal window width minus the window control buttons (+spacing)
89 // keep distanceX relative to the normal window width minus the window control buttons (+spacing)
90 // so that dragging it back doesn't make the window jump around to weird positions, away from the mouse pointer
90 // so that dragging it back doesn't make the window jump around to weird positions, away from the mouse pointer
91 priv.distanceX = MathUtils.clampAndProject(pos.x, 0, target.width, buttonsWidth, target.resizeArea.normalWidth);
91 priv.distanceX = MathUtils.clampAndProject(pos.x, 0, target.width, buttonsWidth, target.resizeArea.normalWidth);
92+ priv.distanceY = MathUtils.clampAndProject(pos.y, 0, target.height, 0, target.resizeArea.normalHeight);
92 } else {
93 } else {
93 priv.distanceX = pos.x;
94 priv.distanceX = pos.x;
95+ priv.distanceY = pos.y;
94 }
96 }
95
97
96− priv.distanceY = pos.y;
97 priv.dragging = true;
98 priv.dragging = true;
98 } else {
99 } else {
99 priv.dragging = false;
100 priv.dragging = false;
qml/Stages/WindowResizeArea.qml+1
@@ -31,6 +31,7 @@ MouseArea {
31 property var windowStateStorage: WindowStateStorage
31 property var windowStateStorage: WindowStateStorage
32 readonly property alias dragging: d.dragging
32 readonly property alias dragging: d.dragging
33 readonly property alias normalWidth: priv.normalWidth
33 readonly property alias normalWidth: priv.normalWidth
34+ readonly property alias normalHeight: priv.normalHeight
34
35
35 // The target item managed by this. Must be a parent or a sibling
36 // The target item managed by this. Must be a parent or a sibling
36 // The area will anchor to it and manage resize events
37 // The area will anchor to it and manage resize events