partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
251 stars 62 forks source link

Basic example not working in Firefox. enters in somekind of a loop.. #157

Open tanovsky opened 4 years ago

tanovsky commented 4 years ago

I created a basic example just to try the library, and notice that it seems to work in all browsers I tested but not in firefox (72.0.2 (64-Bit) on a MAC OS X Yosemite 10.10.5), tested also chrome, safari and opera (In firefox the image generated by kekule seems to be there , but enter some kind of a loop.. and it starts to scrool down for a long time until I have to close the Browser window) Is there any thing obviouly wrong that I have done? If not, is there any workaround? Thank you!

<html lang="en">
  <meta>
    <meta charset="UTF-8">
    <title>kekule example</title>
  </meta>
  <body>
<div id="kek">Kekule mol:</div>

<script src="raphael.js"></script>
<script src="three.js"></script>
<script src="kekule.min.js"></script>

<script>
var chemViewer = new Kekule.ChemWidget.Viewer(document.getElementById('kek'));

// set new object in viewer
var cmlData = '<cml xmlns="http://www.xml-cml.org/schema"><molecule id="m1"><atomArray><atom id="a2" elementType="C" x2="7.493264658965051" y2="35.58088907877604"/><atom id="a3" elementType="O" x2="8.186084981992602" y2="35.18088907877604"/><atom id="a1" elementType="C" x2="6.800444335937501" y2="35.18088907877604"/></atomArray><bondArray><bond id="b2" order="S" atomRefs2="a2 a3"/><bond id="b1" order="S" atomRefs2="a2 a1"/></bondArray></molecule></cml>';

var myMolecule = Kekule.IO.loadFormatData(cmlData, 'cml');
chemViewer.setChemObj(myMolecule);
</script>
  </body>
</html>
partridgejiang commented 4 years ago

It seems that the theme CSS is not included in the HTML page? There are a set of stylesheet files shipped togather with Kekule.js, please find it and use it before the script tag:

<link rel="stylesheet" href="your-path-to-kekule/themes/default/kekule.css" />

After that, the issue should be resolved, :).