diff options
author | Gilles Debunne <debunne@google.com> | 2011-10-25 15:54:51 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-25 15:54:51 -0700 |
commit | dc37203c95e07fa3257c9a6da912dcf1915a3399 (patch) | |
tree | 462f7bd0d7379e955e06884c6d8f528d9c8b1e41 | |
parent | 5ccfcb033bab724d1195cb26d9e5a577d47b4d92 (diff) | |
parent | fec22c6be6ce4988cda358cd405899566c07f032 (diff) | |
download | frameworks_base-dc37203c95e07fa3257c9a6da912dcf1915a3399.zip frameworks_base-dc37203c95e07fa3257c9a6da912dcf1915a3399.tar.gz frameworks_base-dc37203c95e07fa3257c9a6da912dcf1915a3399.tar.bz2 |
Merge "Text handles do not handle scroll correctly"
-rw-r--r-- | core/java/android/widget/TextView.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 5a300e8..9257534 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -9484,8 +9484,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return false; } - int posX = mPositionX + positionX - getScrollX(); - int posY = mPositionY + positionY - getScrollY(); + int posX = mPositionX + positionX; + int posY = mPositionY + positionY; // Offset by 1 to take into account 0.5 and int rounding around getPrimaryHorizontal. return posX >= clip.left - 1 && posX <= clip.right + 1 && @@ -9496,7 +9496,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final int line = mLayout.getLineForOffset(offset); final int lineBottom = mLayout.getLineBottom(line); final int primaryHorizontal = (int) mLayout.getPrimaryHorizontal(offset); - return isVisible(primaryHorizontal, lineBottom); + return isVisible(primaryHorizontal + viewportToContentHorizontalOffset(), + lineBottom + viewportToContentVerticalOffset()); } public void onScrollChanged() { @@ -10643,7 +10644,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mPositionX = (int) (mLayout.getPrimaryHorizontal(offset) - 0.5f - mHotspotX); mPositionY = mLayout.getLineBottom(line); - // Take TextView's padding into account. + // Take TextView's padding and scroll into account. mPositionX += viewportToContentHorizontalOffset(); mPositionY += viewportToContentVerticalOffset(); |