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

Use of SmilesDrawer.apply() with canvas width and height #98

Open adamsardar opened 4 years ago

adamsardar commented 4 years ago

Hi,

I am unable to work out how to propagate the canvas width and height information from the tag through to the drawer when using smilesDrawer.apply(). Example (taken from the jsFiddle example in the documentation):

HTML

<html>
<head>

</head>
<body>
  <canvas width="200" height="200" data-smiles="CCCNC" style="border:1px solid"></canvas>
  <canvas data-smiles="C1CCCCC1"></canvas>
</body>
</html>

JS

SmilesDrawer.apply();

I would expect the first structure to be drawn much smaller than the second, but they are both the same size. Am I missing a crucial option or setting somewhere?

Thank you for developing smilesDrawer - it's awesome!