Giter Site home page Giter Site logo

undefined in v3.1.2 about pdbe-molstar HOT 3 OPEN

kenietz avatar kenietz commented on August 23, 2024
undefined in v3.1.2

from pdbe-molstar.

Comments (3)

midlik avatar midlik commented on August 23, 2024

Hi,

I'm thinking this issue could be caused by calling the update function before the plugin is fully initialized (i.e. before the asynchronous render function has completed).

I expect your javascript code looks something like this:

const viewerContainer = document.getElementById('myViewer')!;
const viewerInstance = new PDBeMolstarPlugin();
viewerInstance.render(viewerContainer, initOptions);
viewerInstance.visual.update(newOptions, false);

Try to change it to something more like this:

const viewerContainer = document.getElementById('myViewer')!;
const viewerInstance = new PDBeMolstarPlugin();
viewerInstance.render(viewerContainer, initOptions).then(() => viewerInstance.visual.update(newOptions, false));

Also, updating to version 3.1.3 could help.

from pdbe-molstar.

midlik avatar midlik commented on August 23, 2024

Or alternatively

const viewerContainer = document.getElementById('myViewer')!;
const viewerInstance = new PDBeMolstarPlugin();
viewerInstance.render(viewerContainer, initOptions);
viewerInstance.events.loadComplete.subscribe(() => viewerInstance.visual.update(newOptions, false));

from pdbe-molstar.

kenietz avatar kenietz commented on August 23, 2024

Hi,
thank you very much for your reply. I tried both solutions which you provided including using v3.1.3. The following kinda worked:

viewerInstance.render(viewerContainer, initOptions);
viewerInstance.events.loadComplete.subscribe(() => viewerInstance.visual.update(newOptions, false));

Both structures got loaded but then the coloring was weird. The colors of the chains we jumping and changing by themselves :) I guess i would have to change my coloring functions as well in order to make them work with the new version of the plugin. Too much work to do tho haha. So for now i will stick with v1.2.1 of the plugin as everything works well with it.

Thank you again for your time and help!

from pdbe-molstar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.