-
1. Re: how to draw AI annotation on document view during mouse drag
JLGJeanLouis Mar 3, 2013 12:26 PM (in response to Royt2011)Hello,
At the begining of ToolMouseDrag(AIToolMessage* message)
add the five following lines, so toolAnnotate(AIAnnotatorMessage *message) will be called each the mouse will be dragged.
AIDocumentViewHandle view;
AIReal zoomview;
AIErr error=kNoErr;
//To call toolAnnotate.
error=sDocView->GetNthDocumentView (0, &view);
error=sDocView->GetDocumentViewZoom(vue, & zoomview);
I used this method in my tools for Illustrator JLG.Dimension for instance and it works well.
JLG.
-
2. Re: how to draw AI annotation on document view during mouse drag
Royt2011 Mar 3, 2013 7:43 PM (in response to JLGJeanLouis)Thanks. Actually I don't understand GetDocumentViewZoon here. But I made my tool work during mouse drag:
{
sDocumentView->GetNthDocumentView(0, &view);
if (view)
{
sDocumentView->GetDocumentViewBounds(view, &viewBounds);
ArtBoundsToViewPort(view, viewBounds, clipRect);
sAnnotator->InvalAnnotationRect(view, &clipRect);
}
}
And draw the rectangle in corresponding drawer function.
{
sDocumentView->GetDocumentViewBounds(message->view, &viewBounds);
ArtBoundsToViewPort(message->view, viewBounds, clipRect);
sAnnotatorDrawer->DefineClipStart(message->drawer);
sAnnotatorDrawer->DrawRect(message->drawer, clipRect, true);
sAnnotatorDrawer->DefineClipEnd(message->drawer);
//
// here is the code for actual drawing in view port cordinate.
//
sAnnotatorDrawer->ClearClip(message->drawer);
}
But I don't know what's the relation between the 'message->view' fetched from AI and the so called current view gotten by 'GetNthDocumentView(0, &view)'
