diff --git a/src/QuickEditor/EditorRoot.qml b/src/QuickEditor/EditorRoot.qml --- a/src/QuickEditor/EditorRoot.qml +++ b/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(); } diff --git a/src/QuickEditor/SelectionRectangle.qml b/src/QuickEditor/SelectionRectangle.qml --- a/src/QuickEditor/SelectionRectangle.qml +++ b/src/QuickEditor/SelectionRectangle.qml @@ -25,6 +25,8 @@ property var drawCanvas: null; property var imageElement: null; + property int minRectSize: 20; + property int mouseAreaSize: 20; signal doubleClicked(); @@ -68,13 +70,13 @@ 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: { @@ -101,18 +103,18 @@ 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 + 1; } if ((parent.y + mouse.y) < bryLimit) { @@ -133,13 +135,13 @@ 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: { @@ -149,7 +151,7 @@ } if ((parent.y + parent.height + mouse.y) > bryLimit) { - parent.height = parent.height + mouse.y; + parent.height = parent.height + mouse.y - mouseAreaSize + 1; } drawCanvas.requestPaint(); @@ -165,24 +167,23 @@ 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 + 1; } if ((parent.y + parent.height + mouse.y) > bryLimit) { - parent.height = parent.height + mouse.y; + parent.height = parent.height + mouse.y - mouseAreaSize + 1; } - drawCanvas.requestPaint(); } } @@ -195,12 +196,12 @@ 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: { @@ -221,17 +222,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 + 1; } drawCanvas.requestPaint(); @@ -246,12 +247,12 @@ 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: { @@ -272,17 +273,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 + 1; } drawCanvas.requestPaint();