Index: src/QuickEditor/EditorRoot.qml =================================================================== --- src/QuickEditor/EditorRoot.qml +++ src/QuickEditor/EditorRoot.qml @@ -188,9 +188,28 @@ ctx.strokeRect(selectionBoxX - 4, selectionBoxY - selectionTextRect.height - 2, selectionTextRect.width + 10, selectionTextRect.height + 8); ctx.fillStyle = systemPalette.windowText; ctx.fillText(selectionText, selectionBoxX, selectionBoxY); + if (selection.zx >= 0 && selection.zy >= 0) { + var zx = selection.zx + 15; + var zy = selection.zy + 15; + if (zx + 72 >= Window.width / Screen.devicePixelRatio) { + zx -= 102; + } + if (zy + 72 >= Window.height / Screen.devicePixelRatio) { + zy -= 102; + } + crossMagnifier.visible = true; + crossMagnifier.x = zx; + crossMagnifier.y = zy; + crossBackground.x = -selection.zx * Screen.devicePixelRatio * 8 + 32; + crossBackground.y = -selection.zy * Screen.devicePixelRatio * 8 + 32; + ctx.strokeRect(zx, zy, 72, 72); + } else { + crossMagnifier.visible = false; + } } else { midHelpText.visible = true; bottomHelpText.visible = false; + crossMagnifier.visible = false; } } @@ -229,6 +248,7 @@ border.width: 1; border.color: Qt.rgba(0, 0, 0, 1); color: Qt.rgba(1, 1, 1, 0.85); + visible: false; anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; @@ -241,6 +261,46 @@ anchors.centerIn: parent; } } + + Rectangle { + id: crossMagnifier; + objectName: "crossMagnifier"; + + height: 72; + width: 72; + border.width: 1; + border.color: Qt.rgba(0, 0, 0, 1); + visible: false; + clip: true + + Image { + id: crossBackground; + objectName: "crossBackground"; + source: "image://snapshot/rawimage"; + cache: false; + smooth: false; + height: Window.height * 8; + width: Window.width * 8; + fillMode: Image.PreserveAspectCrop; + } + + Rectangle { + x: 32; + y: 0; + width: 8; + height: 72; + color: Qt.rgba(0.114, 0.6, 0.953, 0.5); + } + + Rectangle { + x: 0; + y: 32; + width: 72; + height: 8; + color: Qt.rgba(0.114, 0.6, 0.953, 0.5); + } + } + } MouseArea { @@ -269,6 +329,8 @@ } onPositionChanged: { + selection.zx = mouse.x; + selection.zy = mouse.y; selection.x = Math.min(startx, mouse.x); selection.y = Math.min(starty, mouse.y); selection.width = Math.abs(startx - mouse.x); @@ -283,6 +345,12 @@ cropDisplayCanvas.requestPaint(); } } + + onReleased: { + selection.zx = -1; + selection.zy = -1; + cropDisplayCanvas.requestPaint(); + } } Component { 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 zx: -1; + property var zy: -1; signal doubleClicked(); @@ -75,19 +77,28 @@ onPressed: { brxLimit = (parent.x + parent.width) - 20; bryLimit = (parent.y + parent.height) - 20; + parent.zx = parent.x; + parent.zy = parent.y; } onPositionChanged: { if ((parent.x + mouse.x) < brxLimit) { parent.width = parent.width - mouse.x; parent.x = parent.x + mouse.x; + parent.zx = parent.zx + mouse.x; } if ((parent.y + mouse.y) < bryLimit) { parent.height = parent.height - mouse.y; parent.y = parent.y + mouse.y; + parent.zy = parent.zy + mouse.y; } + drawCanvas.requestPaint(); + } + onReleased: { + parent.zx = -1; + parent.zy = -1; drawCanvas.requestPaint(); } } @@ -108,18 +119,27 @@ onPressed: { brxLimit = parent.x + 40; bryLimit = (parent.y + parent.height) - 20; + parent.zx = parent.x + parent.width; + parent.zy = parent.y; } onPositionChanged: { if ((parent.x + parent.width + mouse.x) > brxLimit) { parent.width = parent.width + mouse.x - 20; + parent.zx = parent.zx + mouse.x - 20; } if ((parent.y + mouse.y) < bryLimit) { parent.height = parent.height - mouse.y; parent.y = parent.y + mouse.y; + parent.zy = parent.zy + mouse.y; } + drawCanvas.requestPaint(); + } + onReleased: { + parent.zx = -1; + parent.zy = -1; drawCanvas.requestPaint(); } } @@ -140,18 +160,27 @@ onPressed: { brxLimit = (parent.x + parent.width) - 20; bryLimit = parent.y + 40; + parent.zx = parent.x; + parent.zy = parent.y + parent.height; } onPositionChanged: { if ((parent.x + mouse.x) < brxLimit) { parent.width = parent.width - mouse.x; parent.x = parent.x + mouse.x; + parent.zx = parent.zx + mouse.x; } if ((parent.y + parent.height + mouse.y) > bryLimit) { parent.height = parent.height + mouse.y - 20; + parent.zy = parent.zy + mouse.y - 20; } + drawCanvas.requestPaint(); + } + onReleased: { + parent.zx = -1; + parent.zy = -1; drawCanvas.requestPaint(); } } @@ -172,17 +201,26 @@ onPressed: { brxLimit = parent.x + 40; bryLimit = parent.y + 40; + parent.zx = parent.x + parent.width; + parent.zy = parent.y + parent.height; } onPositionChanged: { if ((parent.x + parent.width + mouse.x) > brxLimit) { parent.width = parent.width + mouse.x - 20; + parent.zx = parent.zx + mouse.x - 20; } if ((parent.y + parent.height + mouse.y) > bryLimit) { parent.height = parent.height + mouse.y - 20; + parent.zy = parent.zy + mouse.y - 20; } + drawCanvas.requestPaint(); + } + onReleased: { + parent.zx = -1; + parent.zy = -1; drawCanvas.requestPaint(); } } @@ -201,14 +239,23 @@ onPressed: { limit = (parent.y + parent.height) - 20; + parent.zx = parent.x + parent.width / 2 - 10; + parent.zy = parent.y; } onPositionChanged: { if ((parent.y + mouse.y) < limit) { parent.height = parent.height - mouse.y; parent.y = parent.y + mouse.y; + parent.zy = parent.zy + mouse.y; } + parent.zx = parent.x + parent.width / 2 - 10 + mouse.x; + drawCanvas.requestPaint(); + } + onReleased: { + parent.zx = -1; + parent.zy = -1; drawCanvas.requestPaint(); } } @@ -227,13 +274,22 @@ onPressed: { limit = parent.y + 40; + parent.zx = parent.x + parent.width / 2 - 10; + parent.zy = parent.y + parent.height; } onPositionChanged: { if ((parent.y + parent.height + mouse.y) > limit) { parent.height = parent.height + mouse.y - 20; + parent.zy = parent.zy + mouse.y - 20; } + parent.zx = parent.x + parent.width / 2 - 10 + mouse.x; + drawCanvas.requestPaint(); + } + onReleased: { + parent.zx = -1; + parent.zy = -1; drawCanvas.requestPaint(); } } @@ -252,14 +308,23 @@ onPressed: { limit = (parent.x + parent.width) - 20; + parent.zx = parent.x; + parent.zy = parent.y + parent.height / 2 - 10; } onPositionChanged: { if ((parent.x + mouse.x) < limit) { parent.width = parent.width - mouse.x; parent.x = parent.x + mouse.x; + parent.zx = parent.zx + mouse.x; } + parent.zy = parent.y + parent.height / 2 - 10 + mouse.y; + drawCanvas.requestPaint(); + } + onReleased: { + parent.zx = -1; + parent.zy = -1; drawCanvas.requestPaint(); } } @@ -278,13 +343,22 @@ onPressed: { limit = parent.x + 40; + parent.zx = parent.x + parent.width; + parent.zy = parent.y + parent.height / 2 - 10; } onPositionChanged: { if ((parent.x + parent.width + mouse.x) > limit) { parent.width = parent.width + mouse.x - 20; + parent.zx = parent.zx + mouse.x - 20; } + parent.zy = parent.y + parent.height / 2 - 10 + mouse.y; + drawCanvas.requestPaint(); + } + onReleased: { + parent.zx = -1; + parent.zy = -1; drawCanvas.requestPaint(); } }