- Posts: 14
- Thank you received: 1
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
PDFViewAct.java OnPDFDoubleTapped(float x, float y) doesn't work right
IP: 60.251.132.249
6 years 4 months ago #14713
by ericatudn
I am using Android version 3.52.6 sample project,
The method OnPDFDoubleTapped(float x, float y) of PDFViewAct.java dosen't work well, the zooming changed wrong.
Please help.
Thank you very much.
The method OnPDFDoubleTapped(float x, float y) of PDFViewAct.java dosen't work well, the zooming changed wrong.
Please help.
Thank you very much.
IP: 212.97.62.176
6 years 4 months ago #14715
by nermeen
Replied by nermeen on topic PDFViewAct.java OnPDFDoubleTapped(float x, float y) doesn't work right
We have checked and the zoom is working correctly.
Can you be more specific please, what do you mean by changing wrong?
Can you be more specific please, what do you mean by changing wrong?
IP: 60.251.132.249
6 years 4 months ago #14717
by ericatudn
Replied by ericatudn on topic PDFViewAct.java OnPDFDoubleTapped(float x, float y) doesn't work right
I think I know what's went wrong in my case, now.
It's because the screen was not refreshed after double tapped.
So I make it happen by add m_view.invalidate() as following:
@Override
public boolean OnPDFDoubleTapped(float x, float y)
{
float mCurZoomLevel = m_view.PDFGetZoom();
if (m_view.PDFGetScale() <= m_view.PDFGetMinScale())
Global.zoomStep = 1;
if ((mCurZoomLevel > Global.zoomLevel && Global.zoomStep > 0) ||
(mCurZoomLevel == 1 && Global.zoomStep < 0)) //reverse zoom step
Global.zoomStep *= -1;
m_view.PDFSetZoom((int) x, (int) y, m_view.PDFGetPos((int) x, (int) y), mCurZoomLevel + Global.zoomStep);
RadaeePluginCallback.getInstance().onDoubleTapped(m_view.PDFGetCurrPage(), x, y);
m_view.invalidate(); // Add this to refresh.
return true;
}
And now the zooming works fine.
So this is my explanation of my problem: "The screen was not refreshed after double tapped"
Dose this help you for understanding my case?
Do you have better solution then what I did (adding m_view.invalidate())?
English is not my native language and I have done my best, hope you can understand what I have tried to say.
Anyway, I solved this problem with my way, unless you have any opinion about this.
Thanks.
It's because the screen was not refreshed after double tapped.
So I make it happen by add m_view.invalidate() as following:
@Override
public boolean OnPDFDoubleTapped(float x, float y)
{
float mCurZoomLevel = m_view.PDFGetZoom();
if (m_view.PDFGetScale() <= m_view.PDFGetMinScale())
Global.zoomStep = 1;
if ((mCurZoomLevel > Global.zoomLevel && Global.zoomStep > 0) ||
(mCurZoomLevel == 1 && Global.zoomStep < 0)) //reverse zoom step
Global.zoomStep *= -1;
m_view.PDFSetZoom((int) x, (int) y, m_view.PDFGetPos((int) x, (int) y), mCurZoomLevel + Global.zoomStep);
RadaeePluginCallback.getInstance().onDoubleTapped(m_view.PDFGetCurrPage(), x, y);
m_view.invalidate(); // Add this to refresh.
return true;
}
And now the zooming works fine.
So this is my explanation of my problem: "The screen was not refreshed after double tapped"
Dose this help you for understanding my case?
Do you have better solution then what I did (adding m_view.invalidate())?
English is not my native language and I have done my best, hope you can understand what I have tried to say.
Anyway, I solved this problem with my way, unless you have any opinion about this.
Thanks.
IP: 212.97.62.176
6 years 4 months ago #14724
by nermeen
Replied by nermeen on topic PDFViewAct.java OnPDFDoubleTapped(float x, float y) doesn't work right
Thanks for the feedback.
We still cannot replicate it in the demo project, but glad that you found a solution.
We still cannot replicate it in the demo project, but glad that you found a solution.
Time to create page: 0.397 seconds