Fix arbitrary aspect in photo editor crop.

This commit is contained in:
John Preston 2025-02-13 19:02:39 +04:00
parent 16830a410c
commit ded0936bc4

View file

@ -59,13 +59,14 @@ void OpenWithPreparedFile(
}; };
auto copy = image->data; auto copy = image->data;
const auto fileImage = std::make_shared<Image>(std::move(copy)); const auto fileImage = std::make_shared<Image>(std::move(copy));
const auto keepRatio = !exactSize.isEmpty();
auto editor = base::make_unique_q<PhotoEditor>( auto editor = base::make_unique_q<PhotoEditor>(
parent, parent,
show, show,
show, show,
fileImage, fileImage,
image->modifications, image->modifications,
EditorData{ .exactSize = exactSize, .keepAspectRatio = true }); EditorData{ .exactSize = exactSize, .keepAspectRatio = keepRatio });
const auto raw = editor.get(); const auto raw = editor.get();
auto layer = std::make_unique<LayerWidget>(parent, std::move(editor)); auto layer = std::make_unique<LayerWidget>(parent, std::move(editor));
InitEditorLayer(layer.get(), raw, std::move(callback)); InitEditorLayer(layer.get(), raw, std::move(callback));