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

Commit b2ebfecc authored by Shu Chen's avatar Shu Chen Committed by Android (Google) Code Review
Browse files

Merge "Use the line height for the magnifier source height."

parents 3c7f3ac4 09ce0f1a
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -454,15 +454,17 @@ public class Editor {
            aspectRatio = 5.5f;
        }

        final Paint.FontMetrics fontMetrics = mTextView.getPaint().getFontMetrics();
        final float sourceHeight = fontMetrics.descent - fontMetrics.ascent;
        final Layout layout = mTextView.getLayout();
        final int line = layout.getLineForOffset(mTextView.getSelectionStart());
        final int sourceHeight =
            layout.getLineBottomWithoutSpacing(line) - layout.getLineTop(line);
        // Slightly increase the height to avoid tooLargeTextForMagnifier() returns true.
        int height = (int)(sourceHeight * zoom) + 2;
        int width = (int)(aspectRatio * height);

        params.setFishEyeStyle()
                .setSize(width, height)
                .setSourceSize(width, Math.round(sourceHeight))
                .setSourceSize(width, sourceHeight)
                .setElevation(0)
                .setInitialZoom(zoom)
                .setClippingEnabled(false);
@@ -5041,7 +5043,7 @@ public class Editor {

            // Vertically snap to middle of current line.
            showPosInView.y = ((mTextView.getLayout().getLineTop(lineNumber)
                    + mTextView.getLayout().getLineBottom(lineNumber)) / 2.0f
                    + mTextView.getLayout().getLineBottomWithoutSpacing(lineNumber)) / 2.0f
                    + mTextView.getTotalPaddingTop() - mTextView.getScrollY()) * mTextViewScaleY;
            return true;
        }