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
a8ee2fd0
Kaydet (Commit)
a8ee2fd0
authored
Mar 01, 2013
tarafından
Tor Lillqvist
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Start hacking on zooming
Change-Id: Ibc9aad490c4616d339e95352a0b8a7f7bed93070
üst
5b1d2fd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
Desktop.java
...top/src/org/libreoffice/experimental/desktop/Desktop.java
+40
-2
androidinst.cxx
vcl/android/androidinst.cxx
+16
-0
No files found.
android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
Dosyayı görüntüle @
a8ee2fd0
...
...
@@ -50,6 +50,7 @@ public class Desktop
public
static
native
void
setViewSize
(
int
width
,
int
height
);
public
static
native
void
key
(
char
c
,
short
timestamp
);
public
static
native
void
touch
(
int
action
,
int
x
,
int
y
,
short
timestamp
);
public
static
native
void
zoom
(
float
scale
,
int
x
,
int
y
);
/**
* This class contains the state that is initialized once and never changes
...
...
@@ -162,19 +163,55 @@ public class Desktop
Bitmap
mBitmap
;
boolean
renderedOnce
;
ScaleGestureDetector
gestureDetector
;
float
scale
=
1
;
public
BitmapView
()
{
super
(
Desktop
.
this
);
setFocusableInTouchMode
(
true
);
// While a scale gesture (two-finger pinch / spread to
// zoom out / in) is in progress we just scale the bitmap
// view (UI elements too, which of course is a bit silly).
// When the scale gesture has finished, we ask LO to zoom
// the document (and reset the view scale, it will be
// replaced by one where the document (not UI elements) is
// displayed at a different zoom level).
// Is that sane? Would it be too slow to ask LO to zoom
// continuously while the gesture is in progress?
gestureDetector
=
new
ScaleGestureDetector
(
Desktop
.
this
,
new
ScaleGestureDetector
.
SimpleOnScaleGestureListener
()
{
@Override
public
boolean
onScaleBegin
(
ScaleGestureDetector
detector
)
{
Log
.
i
(
TAG
,
"onScaleBegin: pivot=("
+
detector
.
getFocusX
()
+
", "
+
detector
.
getFocusY
()
+
")"
);
setPivotX
(
detector
.
getFocusX
());
setPivotY
(
detector
.
getFocusY
());
return
true
;
}
@Override
public
boolean
onScale
(
ScaleGestureDetector
detector
)
{
Log
.
i
(
TAG
,
"onScale: "
+
detector
.
getScaleFactor
());
float
s
=
detector
.
getScaleFactor
();
if
(
s
>
0.95
&&
s
<
1.05
)
return
false
;
scale
*=
s
;
Log
.
i
(
TAG
,
"onScale: "
+
s
+
" => "
+
scale
);
setScaleX
(
scale
);
setScaleY
(
scale
);
return
true
;
}
@Override
public
void
onScaleEnd
(
ScaleGestureDetector
detector
)
{
Log
.
i
(
TAG
,
"onScaleEnd: "
+
scale
);
Desktop
.
zoom
(
scale
,
(
int
)
detector
.
getFocusX
(),
(
int
)
detector
.
getFocusY
());
scale
=
1
;
setScaleX
(
scale
);
setScaleY
(
scale
);
}
});
}
...
...
@@ -226,7 +263,8 @@ public class Desktop
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
gestureDetector
.
onTouchEvent
(
event
);
if
(
gestureDetector
.
onTouchEvent
(
event
))
return
true
;
if
(!
renderedOnce
)
return
super
.
onTouchEvent
(
event
);
...
...
vcl/android/androidinst.cxx
Dosyayı görüntüle @
a8ee2fd0
...
...
@@ -971,4 +971,20 @@ Java_org_libreoffice_experimental_desktop_Desktop_touch(JNIEnv * /* env */,
LOGW
(
"No focused frame to emit event on"
);
}
// public static native void zoom(float scale, int x, int y);
extern
"C"
SAL_JNI_EXPORT
void
JNICALL
Java_org_libreoffice_experimental_desktop_Desktop_zoom
(
JNIEnv
*
/* env */
,
jobject
/* clazz */
,
jfloat
scale
,
jint
x
,
jint
y
)
{
(
void
)
x
;
(
void
)
y
;
if
(
scale
>
1.05
)
{
}
else
if
(
scale
<
0.95
)
{
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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