How to Give User the Ability to Select a Polygon Cloud Annotation Immediately After Drawing One

11 views
Skip to first unread message

Qudama-VP

unread,
Feb 27, 2018, 12:59:07 PM2/27/18
to PDFTron WebViewer
Hi, 

Currently in the PDF document viewer, if you draw a Polygon cloud and try to select that cloud immediately after drawing it, it initiates a new drawing of a cloud, however with the free hand, square, and ellipse tools, selecting the annotation highlights the annotation and gives you the 'Done, Delete, Style, Note' menu tabs. 

Is there any way to achieve the same functionality with the polygon cloud annotation?

Thanks, 

Qudama

Matt Parizeau

unread,
Feb 28, 2018, 6:53:37 PM2/28/18
to PDFTron WebViewer
Hi Qudama,

You could add the following code to your config file. This will apply to the Polyline, Polygon and PolygonCloud tools as they inherit from the polyline tool.

Tools.PolylineCreateTool.prototype.tap = Tools.AnnotationSelectTool.prototype.tap;

Tools.PolylineCreateTool.prototype.mouseLeftUp = function() {
 
var annotManager = readerControl.docViewer.getAnnotationManager();
 
if (annotManager.getSelectedAnnotations().length > 0) {
   
this.annotation = null;
 
}

 
Tools.AnnotationSelectTool.prototype.mouseLeftUp.apply(this, arguments);
};

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages