partridgejiang / Kekule.js

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

3D display not working in moodle #266

Open registerme1963 opened 2 years ago

registerme1963 commented 2 years ago

Hi Tried to insert a 3D model through moodle atto editor plugin. It inserts base64/png with black background. But the image is static and does not allow to rotate the image. Probably Three.js is not loaded properly. Any help

registerme1963 commented 2 years ago

Is it mandatory to load kekule block for each course? This seems painful. How to enable this block globally? After enabling the kekule block, it throws 4 lines of errors "It seems that your web browser is not modern enough to support the drawing function. Please update it" This error is seen in Chrome, Edge, firefox

partridgejiang commented 2 years ago

Please wait for a few days, I'll write a new Moodle filter plugins for loading Kekule.js functions (togather with Three.js) globally in Moodle soon, :).

partridgejiang commented 2 years ago

Hi @registerme1963, please check the new plugin files in src/_extras/MoodleExtensions/moodle/, copy them to the corresponding sub-directory of Moodle. You may now enable the new filter plugin (Kekule.js Loader) to load Kekule.js (and togather with Three.js) in pages all through Moodle. By the way, currently when loading Three.js, a JavaScript error message may be evoked in console but you can simply ignore it.

registerme1963 commented 2 years ago

It is working great. Yes, there are about 8 webGL warnings in the console. Do I still need /blocks/kekukeinjector enabled? You need to publish this in moodle plugin repository for all chemists/biologists to use. If you implement JCAMP and a button link to generate 3D images from 2D (get3D.html) this will the best chemical editor in the web. I will ask my university computer science department to involve in this project regards

partridgejiang commented 2 years ago

The /blocks/kekukeinjector is designed to load Kekule.js for some (but not all) courses in the server. So when the filter plugin is enabled for the global site, kekukeinjector is no longer needed. By the way, it is a good suggestion to include 3D generation functions in Moodle plugin set. I'll implement it soon after the spectrum jobs, :).

registerme1963 commented 2 years ago

Is it not a overhead if kekule related stuffs load on all moodle pages? I see whitelisting of pages in filter setting, but it will be impossible for administrator to add page urls for all users line by line. Why not have some special tags in the kekule structures for the filter to find and add required packages? (as it happens in moodle MathJax filter) Presently the filter works perfectly except on moodle forum rV

partridgejiang commented 2 years ago

The white list is in RegExp pattern, for example, just add a new line of mod/forum, the filter will apply to all pages in Moodle forum (you may need to turn on the Trusted Content permission in Moodle first). By the way, the filter is also checking for special tags actually, :).

partridgejiang commented 2 years ago

Hi @registerme1963, a new generate coordinates button has now been added to the atto editor plugin to automatically layout 2D/3D molecules. An additional boolean flag can also be set at the setting page of plugin to turn on the auto-3D-generation feature. Please check the latest files in /_extras/MoodleExtensions/moodle/ directory, :)

registerme1963 commented 2 years ago

Thanks Let me try and revert back to you