mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +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 xMin = int(xFactor * crop.width()
|
||||
- xFactor * minSize * ((cropRatio > 1.) ? cropRatio : 1.));
|
||||
const auto yMin = int(yFactor * crop.height()
|
||||
- yFactor * minSize * ((cropRatio < 1.) ? (1. / cropRatio) : 1.));
|
||||
const auto xMin = xFactor * int(crop.width() - minSize);
|
||||
// const auto xMin = int(xFactor * crop.width()
|
||||
// - xFactor * minSize * ((cropRatio > 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(
|
||||
diff.x(),
|
||||
|
|
Loading…
Add table
Reference in a new issue