- Posts: 12
- Thank you received: 0
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
Circle Annotation
11 years 6 days ago #9581
by nwixsom
Circle Annotation was created by nwixsom
How does one add a Circle Annotation? The Page.Annotation class does not seem to have an AddAnnotCircle. I'm aware of the AddAnnotEllipse but I'd like to use a real circle.
11 years 4 days ago #9589
by Davide
Replied by Davide on topic Circle Annotation
Hi,
I have made this code for you following this knowledgebase article .
You have to change the onTouchEllipse void of PDFReader class as following.
I have made this code for you following this knowledgebase article .
You have to change the onTouchEllipse void of PDFReader class as following.
Code:
private boolean onTouchEllipse(MotionEvent event)
{
if( m_status == STA_ELLIPSE )
{
int len = 0;
if( m_rects != null ) len = m_rects.length;
int cur = 0;
switch(event.getActionMasked())
{
case MotionEvent.ACTION_DOWN:
float rects[] = new float[len + 4];
for( cur = 0; cur < len; cur++ )
rects[cur] = m_rects[cur];
len += 4;
rects[cur + 0] = event.getX();
rects[cur + 1] = event.getY();
rects[cur + 2] = event.getX();
rects[cur + 3] = event.getY();
m_rects = rects;
break;
case MotionEvent.ACTION_MOVE:
float deltaMoveX = event.getX() - m_rects[len - 2];
float deltaMoveY = event.getY() - m_rects[len - 1];
m_rects[len - 2] = (deltaMoveX > deltaMoveY) ? event.getX() : m_rects[len - 2] + deltaMoveY;
m_rects[len - 1] = (deltaMoveX < deltaMoveY) ? event.getY() : m_rects[len - 1] + deltaMoveX;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
float deltaCancelX = event.getX() - m_rects[len - 2];
float deltaCancelY = event.getY() - m_rects[len - 1];
m_rects[len - 2] = (deltaCancelX > deltaCancelY) ? event.getX() : m_rects[len - 2] + deltaCancelY;
m_rects[len - 1] = (deltaCancelX < deltaCancelY) ? event.getY() : m_rects[len - 1] + deltaCancelX;
break;
}
invalidate();
return true;
}
return false;
}
11 years 4 days ago #9590
by Davide
Replied by Davide on topic Circle Annotation
Hi,
if you want to AddAnnotCircle programmatically, you should use AddAnnotEllipse and maintain the width equals to the height.
if you want to AddAnnotCircle programmatically, you should use AddAnnotEllipse and maintain the width equals to the height.
Time to create page: 0.404 seconds