diff --git a/rdeditor/molViewWidget.py b/rdeditor/molViewWidget.py index 8cd606f..3d1226f 100644 --- a/rdeditor/molViewWidget.py +++ b/rdeditor/molViewWidget.py @@ -304,12 +304,18 @@ def sanitizeDrawMol(self, kekulize=False, drawkekulize=False): finishedDrawing = QtCore.Signal(name="finishedDrawing") def getMolSvg(self): - self.drawer = rdMolDraw2D.MolDraw2DSVG(300, 300) + height = 300 + width = 300 + self.drawer = rdMolDraw2D.MolDraw2DSVG(width, height) # TODO, what if self._drawmol doesn't exist? if self._drawmol is not None: # Chiral tags on R/S # chiraltags = Chem.FindMolChiralCenters(self._drawmol) opts = self.drawer.drawOptions() + opts.fixedBondLength = 15.0 + maxv = Point2D(0.5 * width / opts.scalingFactor, 0.5 * height / opts.scalingFactor) + minv = Point2D(-maxv.x, -maxv.y) + self.drawer.SetScale(width, height, minv, maxv) if self._darkmode: rdMolDraw2D.SetDarkMode(opts) if (not self.molecule_sanitizable) and self.unsanitizable_background_colour: diff --git a/rdeditor/templatehandler.py b/rdeditor/templatehandler.py index 56a489b..e264572 100644 --- a/rdeditor/templatehandler.py +++ b/rdeditor/templatehandler.py @@ -160,10 +160,6 @@ def apply_template_to_canvas(self, mol: Chem.Mol, point: Point2D, templatelabel: """Apply to canvas""" template = Chem.MolFromSmiles(self.templates[templatelabel]["canvas"], sanitize=False) - if mol.GetNumAtoms() == 0: - point.x = 0.0 - point.y = 0.0 - combined = Chem.rdchem.RWMol(Chem.CombineMols(mol, template)) # This should only trigger if we have an empty canvas if not combined.GetNumConformers():