From 4860330c27356864205d4cdb0c43674c065499fe Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Sat, 13 Mar 2021 23:53:07 +0100 Subject: [PATCH] Fix image editor --- imports/NeoChat/Page/ImageEditorPage.qml | 33 ++++++++++-------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/imports/NeoChat/Page/ImageEditorPage.qml b/imports/NeoChat/Page/ImageEditorPage.qml index d5bb5cf0f..49d2e5e58 100644 --- a/imports/NeoChat/Page/ImageEditorPage.qml +++ b/imports/NeoChat/Page/ImageEditorPage.qml @@ -94,7 +94,18 @@ Kirigami.Page { Kirigami.Action { iconName: rootEditorView.resizing ? "dialog-cancel" : "transform-crop" text: rootEditorView.resizing ? i18n("Cancel") : i18nc("@action:button Crop an image", "Crop"); - onTriggered: rootEditorView.resizing = !rootEditorView.resizing; + onTriggered: { + resizeRectangle.width = editImage.paintedWidth + resizeRectangle.height = editImage.paintedHeight + resizeRectangle.x = editImage.horizontalPadding + resizeRectangle.y = editImage.verticalPadding + resizeRectangle.insideX = 100 + resizeRectangle.insideY = 100 + resizeRectangle.insideWidth = 100 + resizeRectangle.insideHeight = 100 + + rootEditorView.resizing = !rootEditorView.resizing; + } }, Kirigami.Action { iconName: "dialog-ok" @@ -144,7 +155,7 @@ Kirigami.Page { width: editImage.paintedWidth height: editImage.paintedHeight - x: 0 + x: editImage.horizontalPadding y: editImage.verticalPadding insideX: 100 @@ -153,23 +164,5 @@ Kirigami.Page { insideHeight: 100 onAcceptSize: rootEditorView.crop(); - - //resizeHandle: KQuickImageEditor.BasicResizeHandle { } - - /*Rectangle { - radius: 2 - width: Kirigami.Units.gridUnit * 8 - height: Kirigami.Units.gridUnit * 3 - anchors.centerIn: parent - Kirigami.Theme.colorSet: Kirigami.Theme.View - color: Kirigami.Theme.backgroundColor - QQC2.Label { - anchors.centerIn: parent - text: "x: " + (resizeRectangle.x - rootEditorView.contentItem.width + editImage.paintedWidth) - + " y: " + (resizeRectangle.y - rootEditorView.contentItem.height + editImage.paintedHeight) - + "\nwidth: " + resizeRectangle.width - + " height: " + resizeRectangle.height - } - }*/ } }