Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drawer doesn't respect canvas dimensions #182

Open
dave-watts opened this issue Feb 20, 2024 · 0 comments
Open

drawer doesn't respect canvas dimensions #182

dave-watts opened this issue Feb 20, 2024 · 0 comments

Comments

@dave-watts
Copy link

The drawer generally draws long compounds horizontally, which is good, therefore I set a long canvas size

<canvas id="smiles-canvas" style="display: inline-block; width: 1050px; height: 400px;" width="1050" height="400"></canvas>

  this.smiles_canvas_dims = { width: 1050, height: 400, padding: 0 };

  this.smilesDrawer = null;
  // Initialize the drawer to draw to canvas
  if(typeof(SmilesDrawer) !== 'undefined')
      this.smilesDrawer = new SmilesDrawer.Drawer(this.smiles_canvas_dims);

then I try to draw a simple smiles

smile="CCCNC"

SmilesDrawer.parse(smile, (tree)=> {
    this.smilesDrawer.draw(tree, "smiles-canvas", "dark", false);
    
}, function (err) {
    console.log(err);
});

However it is drawn outsize of the canvas area. This doesn't happen for other smiles, such as benzene or the protein fragment

CC(C)CC(C(=O)N)NC(=O)C(C)NC(=O)C(CCCCN)NC(=O)C(CC(C)C)NC(=O)C(C)NC(=O)C(CCCCN)NC(=O)C(CC(C)C)NC(=O)C(CC(C)C)NC(=O)C(C)NC(=O)C(CCCCN)NC(=O)C(CC(C)C)NC(=O)C(C)NC(=O)C(CCCCN)NC(=O)C(C)NC(=O)C(CC1=CC=CC=C1)N

which it renders quite well within the canvas (i have to make the padding 0 otherwise the compound is too small to see properly)

Cheers

Dave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant