mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Simplified calculation of minimum crop size in photo editor.
It also fixes cropping of images with unbalanced ratios.
This commit is contained in:
parent
f1669674d8
commit
7526964904
1 changed files with 6 additions and 4 deletions
|
@ -269,10 +269,12 @@ void Crop::performCrop(const QPoint &pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &minSize = st::photoEditorCropMinSize;
|
const auto &minSize = st::photoEditorCropMinSize;
|
||||||
const auto xMin = int(xFactor * crop.width()
|
const auto xMin = xFactor * int(crop.width() - minSize);
|
||||||
- xFactor * minSize * ((cropRatio > 1.) ? cropRatio : 1.));
|
// const auto xMin = int(xFactor * crop.width()
|
||||||
const auto yMin = int(yFactor * crop.height()
|
// - xFactor * minSize * ((cropRatio > 1.) ? cropRatio : 1.));
|
||||||
- yFactor * minSize * ((cropRatio < 1.) ? (1. / cropRatio) : 1.));
|
const auto yMin = yFactor * int(crop.height() - minSize);
|
||||||
|
// const auto yMin = int(yFactor * crop.height()
|
||||||
|
// - yFactor * minSize * ((cropRatio < 1.) ? (1. / cropRatio) : 1.));
|
||||||
|
|
||||||
const auto x = std::clamp(
|
const auto x = std::clamp(
|
||||||
diff.x(),
|
diff.x(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue