Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fe7caee authored by nicolasroard's avatar nicolasroard
Browse files

Fix crash in curves

Change-Id: Ic5b61b3a4653f718bf2e4327f3920b5f39162a49
parent 16652433
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -260,15 +260,22 @@ public class ImageCurves extends ImageShow {
            return true;
        }

        float posX = e.getX() / getWidth();
        float posY = e.getY();
        float margin = Spline.curveHandleSize() / 2;
        float posX = e.getX();
        if (posX < margin) {
            posX = margin;
        }
        float posY = e.getY();
        if (posY < margin) {
            posY = margin;
        }
        if (posX > getWidth() - margin) {
            posX = getWidth() - margin;
        }
        if (posY > getHeight() - margin) {
            posY = getHeight() - margin;
        }
        posX = (posX - margin) / (getWidth() - 2 * margin);
        posY = (posY - margin) / (getHeight() - 2 * margin);

        if (e.getActionMasked() == MotionEvent.ACTION_UP) {