Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

PDFLayout zoom

More
9 years 9 months ago - 9 years 9 months ago #10698 by johannes.bolz
PDFLayout zoom was created by johannes.bolz
I'm trying to implement double-tap zoom using PDFLayoutView/PDFLayout. My code is as follows:
Code:
float zoom = layout.vGetZoom(); if (++zoom >= 5) { zoom = 1.f; } PDFLayout.PDFPos pdfPos = layout.vGetPos((int) x, (int) y); layout.vZoomSet((int) x, (int) y, pdfPos, zoom);
The zoom level is set correctly. The problem is that the document zooms to completely arbitrary places, most of the times even to different pages. I'm using the latest library version 3.6.2b.

The x and y values are from the touch event.
Last edit: 9 years 9 months ago by johannes.bolz.
More
9 years 9 months ago - 9 years 9 months ago #10704 by johannes.bolz
Replied by johannes.bolz on topic PDFLayout zoom
On further inspection, I could observe the following behaviour:
  • The zoom center computed from the touch event coordinates seems to get ignored. Instead, the view always zooms to a point on the upper left of the previous view centre.
  • On zoom out, the view jumps to a different page on multi-page documents.

This is my view hierarchy:
Code:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" > <ViewSwitcher android:layout_width="match_parent" android:layout_height="match_parent"> <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/> <com.radaee.reader.PDFLayoutView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"> </com.radaee.reader.PDFLayoutView> </ViewSwitcher> .... </FrameLayout> .... </android.support.v4.widget.DrawerLayout>
Last edit: 9 years 9 months ago by johannes.bolz.
More
9 years 9 months ago - 9 years 9 months ago #10707 by johannes.bolz
Replied by johannes.bolz on topic PDFLayout zoom
Btw, it would be nice to have at least some documentation on basic things like implementing zoom. The API isn't self-explanatory at all.
Last edit: 9 years 9 months ago by johannes.bolz.
More
9 years 9 months ago #10708 by Davide
Replied by Davide on topic PDFLayout zoom
Hi,
here a workaround for the double tap problem..
Code:
int counter = 0; @Override public boolean OnPDFDoubleTapped(PDFLayout layout, float x, float y) { counter++; if(counter % 2 == 0) { float currZoom = layout.vGetZoom(); float zoomTo = ++currZoom; if (currZoom >= 5) { zoomTo = 1.0f; } final PDFLayout.PDFPos pdfPos = layout.vGetPos((int) x, (int) y); layout.vZoomSet((int) x, (int) y, pdfPos, zoomTo); m_view.invalidate(); } return true; }

Our developers are working to solve it definitively.

You can find some documentation on basic things here : www.radaeepdf.com/support/knowledge-base
More
9 years 9 months ago - 9 years 9 months ago #10711 by johannes.bolz
Replied by johannes.bolz on topic PDFLayout zoom
Hmm, this doesn't fix the problem of the document zooming into unexpected locations. Please note that I'm already using a different workaround of OnPDFDoubleTapped() being called from the wrong SimpleGestureListener methods. This is a different issue.

Also, I disagree that the knowledge base covers all basic things. There's no word on how to implement zoom, for instance. Also, the PDFLayout.vZoom* methods aren't documented either. It's pure guesswork for consumers of your API. The documentation is really lacking, and as others have pointed out, should be improved.
Last edit: 9 years 9 months ago by johannes.bolz.
More
9 years 9 months ago - 9 years 9 months ago #10714 by johannes.bolz
Replied by johannes.bolz on topic PDFLayout zoom
I've noticed that also PDFLayout.vSetPos() has no effect at all, regardless of the x, y and PDFPos parameters passed. So I guess something's broken within the internal document center calculation.
Last edit: 9 years 9 months ago by johannes.bolz.
Time to create page: 0.421 seconds
Powered by Kunena Forum