LibreOffice Module android (master) 1
SelectionHandle.java
Go to the documentation of this file.
1package org.libreoffice.canvas;
2
3import android.graphics.Bitmap;
4import android.graphics.PointF;
5
9
14public abstract class SelectionHandle extends BitmapHandle {
15 private static final long MINIMUM_HANDLE_UPDATE_TIME = 50 * 1000000;
16
17 private final PointF mDragStartPoint = new PointF();
18 private final PointF mDragDocumentPosition = new PointF();
19 private long mLastTime = 0;
20
22
23 public SelectionHandle(LibreOfficeMainActivity context, Bitmap bitmap) {
24 super(bitmap);
25 mContext = context;
26 }
27
31 public void dragStart(PointF point) {
36 }
37
41 public void dragEnd(PointF point) {
42 }
43
47 public void dragging(PointF point) {
48 long currentTime = System.nanoTime();
49 if (currentTime - mLastTime > MINIMUM_HANDLE_UPDATE_TIME) {
50 mLastTime = currentTime;
52 }
53 }
54
58 private void signalHandleMove(float newX, float newY) {
60 float zoom = viewportMetrics.zoomFactor;
61
62 float deltaX = (newX - mDragStartPoint.x) / zoom;
63 float deltaY = (newY - mDragStartPoint.y) / zoom;
64
65 PointF documentPoint = new PointF(mDragDocumentPosition.x + deltaX, mDragDocumentPosition.y + deltaY);
66
68 }
69
70 public abstract HandleType getHandleType();
71
72 public enum HandleType { START, MIDDLE, END }
73}
Common static LOKit functions, functions to send events.
Definition: LOKitShell.java:26
static void sendChangeHandlePositionEvent(SelectionHandle.HandleType handleType, PointF documentCoordinate)
Send change handle position event to LOKitThread.
Main activity of the LibreOffice App.
Bitmap handle canvas element is used to show a handle on the screen.
Selection handle is a common class for "start", "middle" and "end" types of selection handles.
void dragEnd(PointF point)
End of a touch and drag action on the handle.
void dragging(PointF point)
Handle has been dragged.
abstract HandleType getHandleType()
SelectionHandle(LibreOfficeMainActivity context, Bitmap bitmap)
void dragStart(PointF point)
Start of a touch and drag action on the handle.
void signalHandleMove(float newX, float newY)
Signal to move the handle to a new position to LO.
ImmutableViewportMetrics getViewportMetrics()
Implementation of PanZoomTarget.
ImmutableViewportMetrics are used to store the viewport metrics in way that we can access a version o...
def point()
MIDDLE
END
START