Using Custom tools in WebViewer 2.0

Skip to first unread message

Matt Parizeau

May 27, 2015, 7:17:31 PM5/27/15

In WebViewer 1.8 I had a custom tool that worked fine. When I upgraded to WebViewer 2.0 it doesn't seem to work anymore. What are the changes required to make it work with WebViewer 2.0?


If you refer to the custom annotations sample (specifically the diamond.js file) you can compare the differences between defining a tool in 1.8 and 2.0. In 2.0 the value that is set in readerControl.toolModeMap should be an instance of the tool instead of a reference to the tool constructor.
For example in 1.8 it was:
readerControl.toolModeMap['AnnotationCreateCustomDiamond'] = CustomDiamondCreateTool;

In 2.0 it should be:
readerControl.toolModeMap['AnnotationCreateCustomDiamond'] = new CustomDiamondCreateTool(readerControl.docViewer);

In 2.0 you should also call the registerTool function which will allow the tool to have the last colors and properties for the associated annotation remembered when creating a new annotation.
Reply all
Reply to author
0 new messages