reymond-group / smilesDrawer

A small, highly performant JavaScript component for parsing and drawing SMILES strings. Released under the MIT license.
https://smilesdrawer.rocks
MIT License
434 stars 68 forks source link

ReferenceError: MathHelper is not defined #102

Open vasyl-bratushka opened 4 years ago

vasyl-bratushka commented 4 years ago

Looks like you've forgotten to import the MathHelper in the SvgDrawer.js, which throws the ReferenceError.

Moomboh commented 2 years ago

Ran into the same problem. Even seems to affect the demo at https://doc.gdb.tools/smilesDrawer/sd/example/index_svg.html

Daniel-Wedemeyer commented 2 years ago

This error is caused by the SvgDrawer module using the same method for "drawAromaticityRing" as the CanvasDrawer - it looks like the authors copy/pasted the code from the canvas version to the svg version and didn't test the SvgDrawer with aromatic molecules. It can be fixed by:

Daniel-Wedemeyer commented 2 years ago

looking through the source code, it looks like this issue is only present in the published minified version of the script. The code of this repo itself correctly implements an SVG version of drawAromaticityRing, calling svgWrapper.drawCircle.