summaryrefslogtreecommitdiff
path: root/android/experimental
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-03-31 18:27:59 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-07 09:18:05 +0200
commit41b3ed6070b56f32136fd559a45bf640fb1b7422 (patch)
treed014af4c7ae38a66f7b1c65db0be446210577677 /android/experimental
parent6d50c72cba304bc4e31aaaa97f16b356a83f76e5 (diff)
android: convertPosition -> convertToScreen
Change-Id: I2c167173b0b7fb4debfef4455d3336e861a52f20
Diffstat (limited to 'android/experimental')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
index 319ea3530fda..bb6a93ccbbb3 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/overlay/TextCursorView.java
@@ -139,25 +139,29 @@ public class TextCursorView extends View implements View.OnTouchListener {
}
public void repositionWithViewport(float x, float y, float zoom) {
- mCursorScaledPosition = convertPosition(mCursorPosition, x, y, zoom);
+ mCursorScaledPosition = convertToScreen(mCursorPosition, x, y, zoom);
mCursorScaledPosition.right = mCursorScaledPosition.left + CURSOR_WIDTH;
mScaledSelections.clear();
for (RectF selection : mSelections) {
- RectF scaledSelection = convertPosition(selection, x, y, zoom);
+ RectF scaledSelection = convertToScreen(selection, x, y, zoom);
mScaledSelections.add(scaledSelection);
}
- RectF scaledGraphicSelection = convertPosition(mGraphicSelection.mRectangle, x, y, zoom);
+ RectF scaledGraphicSelection = convertToScreen(mGraphicSelection.mRectangle, x, y, zoom);
mGraphicSelection.reposition(scaledGraphicSelection);
invalidate();
}
- private RectF convertPosition(RectF cursorPosition, float x, float y, float zoom) {
- RectF cursor = RectUtils.scale(cursorPosition, zoom);
- cursor.offset(-x, -y);
- return cursor;
+ /**
+ * Convert the input rectangle from document to screen coordinates
+ * according to current viewport data (x, y, zoom).
+ */
+ private static RectF convertToScreen(RectF inputRect, float x, float y, float zoom) {
+ RectF rect = RectUtils.scale(inputRect, zoom);
+ rect.offset(-x, -y);
+ return rect;
}
/**