@@ -74,28 +74,24 @@ MouseArea {
7474 var mouseDiff = Qt.point(currentPoint.x - priv.startPoint.x, currentPoint.y - priv.startPoint.y);
7575 var moveDiff = Qt.point(0, 0);
7676 var sizeDiff = Qt.point(0, 0);
77+ var maxSizeDiff = Qt.point(root.minWidth - root.target.width, root.minHeight - root.target.height)
78+
7779 if (priv.resizeTop || priv.resizeBottom || priv.resizeLeft || priv.resizeRight) {
7880 if (priv.resizeTop) {
79− moveDiff.y += mouseDiff.y;
80− sizeDiff.y += -mouseDiff.y;
81− } else if (priv.resizeBottom) {
82− sizeDiff.y += mouse.y - priv.startPoint.y;
83− priv.startPoint.y = mouse.y
81+ sizeDiff.y = Math.max(maxSizeDiff.y, -currentPoint.y + priv.startPoint.y)
82+ moveDiff.y = -sizeDiff.y
8483 }
85− if (priv.resizeLeft) {
86− moveDiff.x += mouseDiff.x;
87− sizeDiff.x += -mouseDiff.x;
88− } else if (priv.resizeRight) {
89− sizeDiff.x += mouse.x - priv.startPoint.x;
90− priv.startPoint.x = mouse.x
84+ if (priv.resizeBottom) {
85+ sizeDiff.y = Math.max(maxSizeDiff.y, currentPoint.y - priv.startPoint.y)
86+ priv.startPoint.y += sizeDiff.y
9187 }
92− if (priv.windowWidth + sizeDiff.x < root.minWidth) {
93− sizeDiff.x = root.minWidth - priv.windowWidth;
94− moveDiff.x = moveDiff.x == 0 ? 0 : -sizeDiff.x;
88+ if (priv.resizeLeft) {
89+ sizeDiff.x = Math.max(maxSizeDiff.x, -currentPoint.x + priv.startPoint.x)
90+ moveDiff.x = -sizeDiff.x
9591 }
96− if (priv.windowHeight + sizeDiff.y < root.minHeight) {
97− sizeDiff.y = root.minHeight - priv.windowHeight;
98− moveDiff.y = moveDiff.y == 0 ? 0 : -sizeDiff.y;
92+ if (priv.resizeRight) {
93+ sizeDiff.x = Math.max(maxSizeDiff.x, currentPoint.x - priv.startPoint.x)
94+ priv.startPoint.x += sizeDiff.x
9995 }
10096
10197 target.x += moveDiff.x;
@@ -106,6 +102,7 @@ MouseArea {
106102 target.x += mouseDiff.x;
107103 target.y += mouseDiff.y;
108104 }
105+
109106 }
110107
111108 onReleased: {