[Libreoffice-commits] core.git: android/experimental
Ptyl
ptyl at cloudon.com
Thu Jun 27 03:29:12 PDT 2013
android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 19efe68b1ece039027b08139e032b4ce483c113b
Author: Ptyl <ptyl at cloudon.com>
Date: Thu May 9 15:16:00 2013 +0300
Imrove scrolling in the Android "Desktop" app
I got scrolling to respond to the JNI scroll method call. (This is not yet
the gesture I want to implement (scroll by pixels), but at least itâs a
start.)
At first I tried to do some hacking in the C++ part, then found the problem
was in the Java parameters, which set the mouse whell delta too big. When
passed the value 1 or -1 to the Y value of AppSupport.scroll(int x, int y),
the scrolling is reasonable.
Change-Id: Id8fa0ada1a035760b7b05bf21325d0e51ef28fdc
diff --git a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
index b24b0d7..b84333b 100644
--- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
+++ b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
@@ -52,6 +52,12 @@ public class Desktop
BootstrapContext bootstrapContext;
+ private static final Integer ZERO = 0;
+
+ private static int normalize(Number value) {
+ return ZERO.compareTo(-value.intValue());
+ }
+
private void initBootstrapContext()
{
bootstrapContext = new BootstrapContext();
@@ -293,7 +299,7 @@ public class Desktop
// the scroll must have ended.
if (scrollInProgress) {
- AppSupport.scroll((int) translateX, (int) translateY);
+ AppSupport.scroll(normalize(translateX), normalize(translateY));
translateX = translateY = 0;
scrollInProgress = false;
scrollJustEnded = true;
More information about the Libreoffice-commits
mailing list