Q:
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?
A:
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.