Kaydet (Commit) f6e82e2e authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Miklos Vajna

android: convert to document coor. and send it with touch event

Change-Id: I11286f73d23b21ee1e35e332b64b8bb37f7aaae8
üst 06da7383
......@@ -12,7 +12,6 @@ import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import org.libreoffice.LOEventFactory;
import org.libreoffice.LOKitShell;
import org.libreoffice.LibreOfficeMainActivity;
import org.mozilla.gecko.ZoomConstraints;
......@@ -901,9 +900,15 @@ public class JavaPanZoomController
mWaitForDoubleTap = false;
}
private PointF getMotionInDocumentCoordinates(MotionEvent motionEvent) {
RectF viewport = getValidViewportMetrics().getViewport();
PointF viewPoint = new PointF(motionEvent.getX(0), motionEvent.getY(0));
return mTarget.convertViewPointToLayerPoint(viewPoint);
}
@Override
public void onLongPress(MotionEvent motionEvent) {
LOKitShell.sentTouchEvent("LongPress", motionEvent);
LOKitShell.sentTouchEvent("LongPress", motionEvent, getMotionInDocumentCoordinates(motionEvent));
}
@Override
......@@ -911,7 +916,7 @@ public class JavaPanZoomController
// When double-tapping is allowed, we have to wait to see if this is
// going to be a double-tap.
if (!mWaitForDoubleTap) {
LOKitShell.sentTouchEvent("SingleTap", motionEvent);
LOKitShell.sentTouchEvent("SingleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent));
}
// return false because we still want to get the ACTION_UP event that triggers this
return false;
......@@ -921,14 +926,14 @@ public class JavaPanZoomController
public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
// In cases where we don't wait for double-tap, we handle this in onSingleTapUp.
if (mWaitForDoubleTap) {
LOKitShell.sentTouchEvent("SingleTap", motionEvent);
LOKitShell.sentTouchEvent("SingleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent));
}
return true;
}
@Override
public boolean onDoubleTap(MotionEvent motionEvent) {
LOKitShell.sentTouchEvent("DoubleTap", motionEvent);
LOKitShell.sentTouchEvent("DoubleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent));
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment