Image Editor - Keep image within crop bounds.

* 4% of original pixels must be visible.
* The entire crop must be within the image.
* On release, try to scale crop area and image to fit if the crop is invalid.
* Undo to last valid position if that didn't work.
* Additionally, center thumbs now do not respect aspect ratio lock.
This commit is contained in:
Alan Evans
2019-05-16 17:50:49 -03:00
committed by Greyson Parrelli
parent 068ffc2167
commit bf759711ef
14 changed files with 304 additions and 35 deletions

View File

@@ -8,7 +8,7 @@ import org.thoughtcrime.securesms.imageeditor.model.EditorElement;
abstract class ElementEditSession implements EditSession {
private final Matrix inverseMatrix;
private final Matrix inverseMatrix;
final EditorElement selected;
@@ -60,7 +60,7 @@ abstract class ElementEditSession implements EditSession {
* @param matrix Matrix to transform point with.
* @param src Input point.
*/
static void mapPoint(@NonNull PointF dst, @NonNull Matrix matrix, @NonNull PointF src) {
private static void mapPoint(@NonNull PointF dst, @NonNull Matrix matrix, @NonNull PointF src) {
float[] in = { src.x, src.y };
float[] out = new float[2];
matrix.mapPoints(out, in);