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

Commit 29e59d8d authored by Petar Šegina's avatar Petar Šegina
Browse files

Do not round corners on tall selection rectangles

When performing the smart select animation, some of the selection
rectangles may be taller than they are wide (e.g. due to a very large
line-height). Since in these cases we cannot properly round the corners
and the effect looks off, the agreed upon action is to not round the
corners of these selection rectangles at all.

Test: manual - run SmartSelectSprite on a manually constructed set of
rectangles and verify that it behaves correctly

Change-Id: Ifd02005e3d2709736c34f6d07671a4eb7a9557db
parent b2fb1820
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -156,6 +156,12 @@ final class SmartSelectSprite {
            mExpansionDirection = expansionDirection;
            mRectangleBorderType = rectangleBorderType;
            mStrokeWidth = strokeWidth;

            if (boundingRectangle.height() > boundingRectangle.width()) {
                setRoundPercentage(0.0f);
            } else {
                setRoundPercentage(1.0f);
            }
        }

        /*
@@ -220,6 +226,10 @@ final class SmartSelectSprite {
            mRoundPercentage = newPercentage;
        }

        public float getRoundPercentage() {
            return mRoundPercentage;
        }

        private void setLeftBoundary(final float leftBoundary) {
            mLeftBoundary = leftBoundary;
        }
@@ -577,7 +587,7 @@ final class SmartSelectSprite {
        final ObjectAnimator animator = ObjectAnimator.ofFloat(
                shape,
                RoundedRectangleShape.PROPERTY_ROUND_PERCENTAGE,
                1.0F, 0.0F);
                shape.getRoundPercentage(), 0.0F);
        animator.setDuration(CORNER_DURATION);
        animator.addUpdateListener(listener);
        animator.setInterpolator(mCornerInterpolator);