edit/crop: Fix edge resize for fixed aspect ratio
Allow to decrease the size when dragging an edge with fixed aspect ratio. Issue #409
This commit is contained in:
parent
6920fda2be
commit
281080a21f
1 changed files with 24 additions and 8 deletions
|
|
@ -358,15 +358,31 @@ mod imp {
|
||||||
let coord = (x, y);
|
let coord = (x, y);
|
||||||
|
|
||||||
let new_area = if let Some(aspect_ratio) = imp.aspect_ratio() {
|
let new_area = if let Some(aspect_ratio) = imp.aspect_ratio() {
|
||||||
let u =
|
// Width for height an vice versa is only needed if corner is dragged
|
||||||
imp.new_crop_area_aspect_ratio(&resize, true, coord, aspect_ratio);
|
// and both dimensions change
|
||||||
let v =
|
if resize.handle.h_edge().is_none() {
|
||||||
imp.new_crop_area_aspect_ratio(&resize, false, coord, aspect_ratio);
|
imp.new_crop_area_aspect_ratio(&resize, true, coord, aspect_ratio)
|
||||||
|
} else if resize.handle.v_edge().is_none() {
|
||||||
if u.area() > v.area() {
|
imp.new_crop_area_aspect_ratio(&resize, false, coord, aspect_ratio)
|
||||||
u
|
|
||||||
} else {
|
} else {
|
||||||
v
|
let u = imp.new_crop_area_aspect_ratio(
|
||||||
|
&resize,
|
||||||
|
true,
|
||||||
|
coord,
|
||||||
|
aspect_ratio,
|
||||||
|
);
|
||||||
|
let v = imp.new_crop_area_aspect_ratio(
|
||||||
|
&resize,
|
||||||
|
false,
|
||||||
|
coord,
|
||||||
|
aspect_ratio,
|
||||||
|
);
|
||||||
|
|
||||||
|
if u.area() > v.area() {
|
||||||
|
u
|
||||||
|
} else {
|
||||||
|
v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
imp.new_crop_area_aspect_free(&resize, coord)
|
imp.new_crop_area_aspect_free(&resize, coord)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue