Comments (6)
No, currently we just provide a "nomouse" option in the viewer which disables all mouse/touch handling under the presumption you want to provide your own handlers, but then you become responsible for transforming the scene in response to user input.
What is your use case and what sort of events would you like to see?
from 3dmol.js.
My use case is to save the viewer state. After page refresh or when reloading, the model will have the same zoom, rotation and position.
For example, if you embed a 3Dmol model in iPython notebook, you'll be able to change the state of the model and it will be saved automatically by the widget embedding the model.
It will be nice to have an event for every property in the model.
For now events for rotate, zoom and translate will be great.
from 3dmol.js.
getView and setView can be used to get and set the viewer state. getView in particular is pretty lightweight, so there should be no trouble just binding to the mousemove/touchmove/mousewheel events on the viewer and calling getView after each event. Make sure you use jQuery to bind the HTML element (the one provided to initialize the viewer) to these events and bind them to your handler after the 3Dmol viewer has been initialized. This way getView should get called after the view has been updated based on the mouse movement.
from 3dmol.js.
A generic 'change' event that will fire when there is a change in rotation, position or zoom might be cleaner to work with but you probably think that my use case is specific so getView and setView should work.
getView and setView are method of the viewer?
I don't see them in the docs.
http://3dmol.csb.pitt.edu/doc/$3Dmol.GLViewer.html
from 3dmol.js.
Hmm, they were apparently missing the @function JSDoc tag. I've fixed this.
from 3dmol.js.
Thank you for the answer and fix.
from 3dmol.js.
Related Issues (20)
- Visualizing multiple protein structures in the same viewer HOT 3
- Not showing Hydrogen atoms HOT 4
- Is it possible to have post-translational modifications (PTMs) features in 3Dmol? HOT 1
- Discrepancy in Atom Rendering Between 3Dmol.js and VESTA for Al1Cd2_H.cif File HOT 4
- .render() is not showing updated representation of models HOT 2
- [BUG] defaultcolors not applied when using addModelsAsFrames HOT 1
- py3Dmol is not working [BUG] HOT 4
- [BUG] Double bonds rendered out of plane (CID: 243, 2244) HOT 2
- Support wireframe and opacity for addIsoSurface in VRML Export HOT 2
- [BUG] Crystal supercell displays in a very weird way HOT 10
- Enable Model Translation on Right-Click and Mouse Movement. HOT 3
- Can't select properly, nor generate cartoon & multiple structures HOT 9
- Assign Property to selection, select and colour by property HOT 2
- View multiple models with absolute positions (i.e. no centering) HOT 8
- Stick representation for IONS HOT 2
- [BUG] WRONG BONDS BEING DRAWN HOT 8
- Opening MANY models efficiently HOT 3
- PRMTOP needs to parse residue names
- Highlighting specific residues HOT 7
- use less CPU for animations HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 3dmol.js.