Hi guys! Great plugin.
I'm trying to get Annotators to work. There is a complex interaction between Illustrator and the Annotators. The process is not very clear.
If you get it wrong you end up with stale copies of previous annotations being left on the screen.
Below are two simple scripts which are an example of the problem. The second draws a large triangle in a fixed position. The colo(u)r cycles every draw operation. Try to scroll around, especially with a mouse-scroll-wheel!
The first is to clear the annotations so that you can remove the effects being redrawn
- --
//1. CleanAnnotations.js
Annotator.disposeAll();
//----
//2. Annotate.js
//-----------------------
print("About to register annotator");
var annotator = new Annotator();
var count=0;
var drawHook = function drawHookFun(drawer,view){
var myBounds=drawer.getBoundsRect();
var point = drawer.getOrigin();
++count;
print(":::DRAW::: Count: "+count);
print("My bounds: "+myBounds);
print("Update rect: " +drawer.getUpdateRect());
print("Clip rect: " +drawer.getClipRect());
var knownBounds = new Rectangle(400,100,500,500);
var artworkBounds= view.getBounds();
if((count %2)==0) {
print("Clear");
drawer.setColor(13);
drawer.drawUpArrow(400,100,500,500);
}
else {
print("Fill");
drawer.setColor(0);
drawer.drawUpArrow(400,100,500,500);
}
print("Done draw().");
};
var invalidateHook = function invalidateHookFun(){
print(":::INVALIDATE::: Called");
print(":::INVALIDATE::: Finished");
};
annotator.setOnDraw(drawHook);
annotator.setOnInvalidate(invalidateHook);
annotator.setActive(true);
print("Set annotator active");