72
72
var windowGeometry = windowStateStorage.getGeometry(root.windowId,
73
73
Qt.rect(target.x, target.y, defaultWidth, defaultHeight));
75
target.requestedWidth = Math.min(Math.max(windowGeometry.width, minWidth), screenWidth);
76
target.requestedHeight = Math.min(Math.max(windowGeometry.height, minHeight), root.screenHeight - PanelState.panelHeight);
75
target.requestedWidth = Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth);
76
target.requestedHeight = Math.min(Math.max(windowGeometry.height, d.minimumHeight), root.screenHeight - PanelState.panelHeight);
77
77
target.x = Math.max(Math.min(windowGeometry.x, root.screenWidth - target.requestedWidth), 0)
78
78
target.y = Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight)
95
readonly property int maxSafeInt: 2147483647
96
readonly property int maxSizeIncrement: units.gu(40)
98
readonly property int minimumWidth: root.target ? Math.max(root.minWidth, root.target.minimumWidth) : root.minWidth
99
onMinimumWidthChanged: {
100
if (target.requestedWidth < minimumWidth) {
101
target.requestedWidth = minimumWidth;
104
readonly property int minimumHeight: root.target ? Math.max(root.minHeight, root.target.minimumHeight) : root.minHeight
105
onMinimumHeightChanged: {
106
if (target.requestedHeight < minimumHeight) {
107
target.requestedHeight = minimumHeight;
110
readonly property int maximumWidth: root.target && root.target.maximumWidth >= minimumWidth && root.target.maximumWidth > 0
111
? root.target.maximumWidth : maxSafeInt
112
onMaximumWidthChanged: {
113
if (target.requestedWidth > maximumWidth) {
114
target.requestedWidth = maximumWidth;
117
readonly property int maximumHeight: root.target && root.target.maximumHeight >= minimumHeight && root.target.maximumHeight > 0
118
? root.target.maximumHeight : maxSafeInt
119
onMaximumHeightChanged: {
120
if (target.requestedHeight > maximumHeight) {
121
target.requestedHeight = maximumHeight;
124
readonly property int widthIncrement: {
128
if (root.target.widthIncrement > 0) {
129
if (root.target.widthIncrement < maxSizeIncrement) {
130
return root.target.widthIncrement;
132
return maxSizeIncrement;
138
readonly property int heightIncrement: {
142
if (root.target.heightIncrement > 0) {
143
if (root.target.heightIncrement < maxSizeIncrement) {
144
return root.target.heightIncrement;
146
return maxSizeIncrement;
94
153
property bool leftBorder: false
95
154
property bool rightBorder: false
96
155
property bool topBorder: false
210
269
var pos = mapToItem(target.parent, mouse.x, mouse.y);
212
var deltaX = pos.x - d.startMousePosX;
213
var deltaY = pos.y - d.startMousePosY;
271
var deltaX = Math.floor((pos.x - d.startMousePosX) / d.widthIncrement) * d.widthIncrement;
272
var deltaY = Math.floor((pos.y - d.startMousePosY) / d.heightIncrement) * d.heightIncrement;
215
274
if (d.leftBorder) {
216
275
var newTargetX = d.startX + deltaX;
217
if (target.x + target.width > newTargetX + minWidth) {
218
target.requestedWidth = target.x + target.width - newTargetX;
276
var rightBorderX = target.x + target.width;
277
if (rightBorderX > newTargetX + d.minimumWidth) {
278
if (rightBorderX < newTargetX + d.maximumWidth) {
279
target.requestedWidth = rightBorderX - newTargetX;
281
target.requestedWidth = d.maximumWidth;
220
target.requestedWidth = minWidth;
284
target.requestedWidth = d.minimumWidth;
223
287
} else if (d.rightBorder) {
224
if (d.startWidth + deltaX >= minWidth) {
225
target.requestedWidth = d.startWidth + deltaX;
288
var newWidth = d.startWidth + deltaX;
289
if (newWidth > d.minimumWidth) {
290
if (newWidth < d.maximumWidth) {
291
target.requestedWidth = newWidth;
293
target.requestedWidth = d.maximumWidth;
227
target.requestedWidth = minWidth;
296
target.requestedWidth = d.minimumWidth;
231
300
if (d.topBorder) {
232
301
var newTargetY = d.startY + deltaY;
233
if (target.y + target.height > newTargetY + minHeight) {
234
target.requestedHeight = target.y + target.height - newTargetY;
302
var bottomBorderY = target.y + target.height;
303
if (bottomBorderY > newTargetY + d.minimumHeight) {
304
if (bottomBorderY < newTargetY + d.maximumHeight) {
305
target.requestedHeight = bottomBorderY - newTargetY;
307
target.requestedHeight = d.maximumHeight;
236
target.requestedHeight = minHeight;
310
target.requestedHeight = d.minimumHeight;
239
313
} else if (d.bottomBorder) {
240
if (d.startHeight + deltaY >= minHeight) {
241
target.requestedHeight = d.startHeight + deltaY;
314
var newHeight = d.startHeight + deltaY;
315
if (newHeight > d.minimumHeight) {
316
if (newHeight < d.maximumHeight) {
317
target.requestedHeight = newHeight;
319
target.requestedHeight = d.maximumHeight;
243
target.requestedHeight = minHeight;
322
target.requestedHeight = d.minimumHeight;