Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
7f0dfb3a
Kaydet (Commit)
7f0dfb3a
authored
Nis 09, 2015
tarafından
Tomaž Vajngerl
Kaydeden (comit)
Miklos Vajna
Nis 13, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
android: tune the viewport moving to cursor position on key input
Change-Id: Ie420307f28cc05ca03fabe47f46712f67c6f18fa
üst
20714274
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
10 deletions
+43
-10
InvalidationHandler.java
...ndroid3/src/java/org/libreoffice/InvalidationHandler.java
+36
-2
LOKitShell.java
...ental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
+1
-1
JavaPanZoomController.java
...src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
+6
-7
No files found.
android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
Dosyayı görüntüle @
7f0dfb3a
...
...
@@ -8,6 +8,8 @@ import android.net.Uri;
import
org.libreoffice.canvas.SelectionHandle
;
import
org.libreoffice.kit.Document
;
import
org.libreoffice.overlay.DocumentOverlay
;
import
org.mozilla.gecko.gfx.GeckoLayerClient
;
import
org.mozilla.gecko.gfx.ImmutableViewportMetrics
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -19,11 +21,13 @@ import java.util.List;
public
class
InvalidationHandler
implements
Document
.
MessageCallback
{
private
static
String
LOGTAG
=
InvalidationHandler
.
class
.
getSimpleName
();
private
final
DocumentOverlay
mDocumentOverlay
;
private
final
GeckoLayerClient
mLayerClient
;
private
OverlayState
mState
;
private
boolean
mKeyEvent
=
false
;
public
InvalidationHandler
(
LibreOfficeMainActivity
mainActivity
)
{
mDocumentOverlay
=
mainActivity
.
getDocumentOverlay
();
mLayerClient
=
mainActivity
.
getLayerClient
();
mState
=
OverlayState
.
NONE
;
}
...
...
@@ -153,8 +157,7 @@ public class InvalidationHandler implements Document.MessageCallback {
mDocumentOverlay
.
positionHandle
(
SelectionHandle
.
HandleType
.
MIDDLE
,
cursorRectangle
);
if
(
mKeyEvent
)
{
PointF
point
=
new
PointF
(
cursorRectangle
.
centerX
(),
cursorRectangle
.
centerY
());
LOKitShell
.
moveViewportTo
(
point
,
null
);
moveViewportToMakeCursorVisible
(
cursorRectangle
);
mKeyEvent
=
false
;
}
...
...
@@ -164,6 +167,37 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
/**
* Move the viewport to show the cursor. The cursor will appear at the
* viewport position depending on where the cursor is relative to the
* viewport (either cursor is above, below, on left or right).
*
* @param cursorRectangle - cursor position on the document
*/
public
void
moveViewportToMakeCursorVisible
(
RectF
cursorRectangle
)
{
RectF
moveToRect
=
mLayerClient
.
getViewportMetrics
().
getCssViewport
();
if
(
moveToRect
.
contains
(
cursorRectangle
))
{
return
;
}
float
newLeft
=
moveToRect
.
left
;
float
newTop
=
moveToRect
.
top
;
if
(
cursorRectangle
.
right
<
moveToRect
.
left
||
cursorRectangle
.
left
<
moveToRect
.
left
)
{
newLeft
=
cursorRectangle
.
left
-
(
moveToRect
.
width
()
*
0.1f
);
}
else
if
(
cursorRectangle
.
right
>
moveToRect
.
right
||
cursorRectangle
.
left
>
moveToRect
.
right
)
{
newLeft
=
cursorRectangle
.
right
-
(
moveToRect
.
width
()
*
0.9f
);
}
if
(
cursorRectangle
.
top
<
moveToRect
.
top
||
cursorRectangle
.
bottom
<
moveToRect
.
top
)
{
newTop
=
cursorRectangle
.
top
-
(
moveToRect
.
height
()
*
0.1f
);
}
else
if
(
cursorRectangle
.
bottom
>
moveToRect
.
bottom
||
cursorRectangle
.
top
>
moveToRect
.
bottom
)
{
newTop
=
cursorRectangle
.
bottom
-
(
moveToRect
.
height
()
/
2.0f
);
}
LOKitShell
.
moveViewportTo
(
new
PointF
(
newLeft
,
newTop
),
null
);
}
/**
* Handles the text selection start message
*
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
Dosyayı görüntüle @
7f0dfb3a
...
...
@@ -158,7 +158,7 @@ public class LOKitShell {
}
/**
* Move the viewport to the desired point, and change the zoom level.
* Move the viewport to the desired point
(top-left)
, and change the zoom level.
* Ensure this runs on the UI thread.
*/
public
static
void
moveViewportTo
(
final
PointF
position
,
final
Float
zoom
)
{
...
...
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
Dosyayı görüntüle @
7f0dfb3a
...
...
@@ -418,7 +418,7 @@ public class JavaPanZoomController
}
else
{
setState
(
PanZoomState
.
PANNING
);
}
LibreOfficeMainActivity
.
mAppContext
.
hideSoftKeyboard
();
//
LibreOfficeMainActivity.mAppContext.hideSoftKeyboard();
}
private
float
panDistance
(
MotionEvent
move
)
{
...
...
@@ -1023,16 +1023,15 @@ public class JavaPanZoomController
}
/**
* Move t
o centerPosition and zoom to the desired input zoom factor. Input zoom
* factor can be null, in this case leave the zoom unchanged.
* Move t
he viewport to the top-left point to and zoom to the desired
*
zoom factor. Input zoom
factor can be null, in this case leave the zoom unchanged.
*/
public
boolean
animatedMove
(
PointF
centerPoin
t
,
Float
zoom
)
{
public
boolean
animatedMove
(
PointF
topLef
t
,
Float
zoom
)
{
RectF
moveToRect
=
getMetrics
().
getCssViewport
();
moveToRect
.
offsetTo
(
centerPoint
.
x
-
moveToRect
.
width
()
/
2.0f
,
centerPoint
.
y
-
moveToRect
.
height
()
/
2.0f
);
moveToRect
.
offsetTo
(
topLeft
.
x
,
topLeft
.
y
);
ImmutableViewportMetrics
finalMetrics
=
getMetrics
();
finalMetrics
=
finalMetrics
.
setViewportOrigin
(
moveToRect
.
left
*
finalMetrics
.
zoomFactor
,
moveToRect
.
top
*
finalMetrics
.
zoomFactor
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment