Index: src/QuickEditor/EditorRoot.qml =================================================================== --- src/QuickEditor/EditorRoot.qml +++ src/QuickEditor/EditorRoot.qml @@ -271,8 +271,8 @@ onPositionChanged: { selection.x = Math.min(startx, mouse.x); selection.y = Math.min(starty, mouse.y); - selection.width = Math.abs(startx - mouse.x); - selection.height = Math.abs(starty - mouse.y); + selection.width = Math.abs(startx - mouse.x) + 1; + selection.height = Math.abs(starty - mouse.y) + 1; cropDisplayCanvas.requestPaint(); } Index: src/QuickEditor/SelectionRectangle.qml =================================================================== --- src/QuickEditor/SelectionRectangle.qml +++ src/QuickEditor/SelectionRectangle.qml @@ -25,6 +25,8 @@ property var drawCanvas: null; property var imageElement: null; + property var minRectSize: 20; + property var mouseAreaSize: 20; signal doubleClicked(); @@ -68,24 +70,24 @@ anchors.top: parent.top; anchors.left: parent.left; - width: 20; - height: 20; + width: mouseAreaSize; + height: mouseAreaSize; cursorShape: Qt.SizeFDiagCursor; onPressed: { - brxLimit = (parent.x + parent.width) - 20; - bryLimit = (parent.y + parent.height) - 20; + brxLimit = (parent.x + parent.width) - minRectSize; + bryLimit = (parent.y + parent.height) - minRectSize; } onPositionChanged: { if ((parent.x + mouse.x) < brxLimit) { - parent.width = parent.width - mouse.x; parent.x = parent.x + mouse.x; + parent.width = parent.width - mouse.x; } if ((parent.y + mouse.y) < bryLimit) { - parent.height = parent.height - mouse.y; parent.y = parent.y + mouse.y; + parent.height = parent.height - mouse.y; } drawCanvas.requestPaint(); @@ -101,23 +103,23 @@ anchors.top: parent.top; anchors.right: parent.right; - width: 20; - height: 20; + width: mouseAreaSize; + height: mouseAreaSize; cursorShape: Qt.SizeBDiagCursor; onPressed: { - brxLimit = parent.x + 20; - bryLimit = (parent.y + parent.height) - 20; + brxLimit = parent.x + mouseAreaSize + minRectSize; + bryLimit = (parent.y + parent.height) - minRectSize; } onPositionChanged: { if ((parent.x + parent.width + mouse.x) > brxLimit) { - parent.width = parent.width + mouse.x; + parent.width = parent.width + mouse.x - mouseAreaSize; } if ((parent.y + mouse.y) < bryLimit) { - parent.height = parent.height - mouse.y; parent.y = parent.y + mouse.y; + parent.height = parent.height - mouse.y; } drawCanvas.requestPaint(); @@ -133,23 +135,23 @@ anchors.bottom: parent.bottom; anchors.left: parent.left; - width: 20; - height: 20; + width: mouseAreaSize; + height: mouseAreaSize; cursorShape: Qt.SizeBDiagCursor; onPressed: { - brxLimit = (parent.x + parent.width) - 20; - bryLimit = parent.y + 20; + brxLimit = (parent.x + parent.width) - minRectSize; + bryLimit = parent.y + mouseAreaSize + minRectSize; } onPositionChanged: { if ((parent.x + mouse.x) < brxLimit) { - parent.width = parent.width - mouse.x; parent.x = parent.x + mouse.x; + parent.width = parent.width - mouse.x; } if ((parent.y + parent.height + mouse.y) > bryLimit) { - parent.height = parent.height + mouse.y; + parent.height = parent.height + mouse.y - mouseAreaSize; } drawCanvas.requestPaint(); @@ -165,22 +167,22 @@ anchors.bottom: parent.bottom; anchors.right: parent.right; - width: 20; - height: 20; + width: mouseAreaSize; + height: mouseAreaSize; cursorShape: Qt.SizeFDiagCursor; onPressed: { - brxLimit = parent.x + 20; - bryLimit = parent.y + 20; + brxLimit = parent.x + mouseAreaSize + minRectSize; + bryLimit = parent.y + mouseAreaSize + minRectSize; } onPositionChanged: { if ((parent.x + parent.width + mouse.x) > brxLimit) { - parent.width = parent.width + mouse.x; + parent.width = parent.width + mouse.x - mouseAreaSize; } if ((parent.y + parent.height + mouse.y) > bryLimit) { - parent.height = parent.height + mouse.y; + parent.height = parent.height + mouse.y - mouseAreaSize; } drawCanvas.requestPaint(); @@ -195,18 +197,18 @@ anchors.horizontalCenter: parent.horizontalCenter; anchors.top: parent.top; - width: 20; - height: 20; + width: mouseAreaSize; + height: mouseAreaSize; cursorShape: Qt.SizeVerCursor; onPressed: { - limit = (parent.y + parent.height) - 20; + limit = (parent.y + parent.height) - minRectSize; } onPositionChanged: { if ((parent.y + mouse.y) < limit) { - parent.height = parent.height - mouse.y; parent.y = parent.y + mouse.y; + parent.height = parent.height - mouse.y; } drawCanvas.requestPaint(); @@ -221,17 +223,17 @@ anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; - width: 20; - height: 20; + width: mouseAreaSize; + height: mouseAreaSize; cursorShape: Qt.SizeVerCursor; onPressed: { - limit = parent.y + 20; + limit = parent.y + mouseAreaSize + minRectSize; } onPositionChanged: { if ((parent.y + parent.height + mouse.y) > limit) { - parent.height = parent.height + mouse.y; + parent.height = parent.height + mouse.y - mouseAreaSize; } drawCanvas.requestPaint(); @@ -246,18 +248,18 @@ anchors.verticalCenter: parent.verticalCenter; anchors.left: parent.left; - width: 20; - height: 20; + width: mouseAreaSize; + height: mouseAreaSize; cursorShape: Qt.SizeHorCursor; onPressed: { - limit = (parent.x + parent.width) - 20; + limit = (parent.x + parent.width) - minRectSize; } onPositionChanged: { if ((parent.x + mouse.x) < limit) { - parent.width = parent.width - mouse.x; parent.x = parent.x + mouse.x; + parent.width = parent.width - mouse.x; } drawCanvas.requestPaint(); @@ -272,17 +274,17 @@ anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; - width: 20; - height: 20; + width: mouseAreaSize; + height: mouseAreaSize; cursorShape: Qt.SizeHorCursor; onPressed: { - limit = parent.x + 20; + limit = parent.x + mouseAreaSize + minRectSize; } onPositionChanged: { if ((parent.x + parent.width + mouse.x) > limit) { - parent.width = parent.width + mouse.x; + parent.width = parent.width + mouse.x - mouseAreaSize; } drawCanvas.requestPaint();