Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate the view via command won't save state #990

Open
hainm opened this issue Aug 14, 2021 · 1 comment
Open

Rotate the view via command won't save state #990

hainm opened this issue Aug 14, 2021 · 1 comment
Labels

Comments

@hainm
Copy link
Collaborator

hainm commented Aug 14, 2021

From @lilyminium:
#948 (comment)

Thank you @hainm for this lovely widget :-) I was wondering if there is any way to make changes to the viewer controls permanent / encoded into the JavaScript state. For example in the picture below, if I rotate the view v1 by r1, it alters the earlier view but the state does not persist into cell In [72], or into the state when the widget state is embedded into the notebook.

We are looking into this because we've found the nglview widget to be an amazing tool for nbsphinx tutorials, which can get rendered into HTML pages with interactive molecule viewers. It would be fantastic to get the full functionality that is available in a normal notebook.

Screen Shot 2021-08-12 at 7 19 39 pm

Embedded state:

   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'_camera_orientation': [254.02609942068673,\n",
       "  0,\n",
       "  0,\n",
       "  0,\n",
       "  0,\n",
       "  254.02609942068673,\n",
       "  0,\n",
       "  0,\n",
       "  0,\n",
       "  0,\n",
       "  254.02609942068673,\n",
       "  0,\n",
       "  -57.05999892950058,\n",
       "  -56.39000029861927,\n",
       "  -73.00499725341797,\n",
       "  1],\n",
       " '_camera_str': 'orthographic',\n",
       " '_dom_classes': (),\n",
       " '_gui_theme': None,\n",
       " '_ibtn_fullscreen': 'IPY_MODEL_52bd361fbfec475a810b79e97665abc7',\n",
       " '_igui': None,\n",
       " '_iplayer': 'IPY_MODEL_99c4db24097a4591b10af675009289a2',\n",
       " '_model_module': 'nglview-js-widgets',\n",
       " '_model_module_version': '3.0.1',\n",
       " '_model_name': 'NGLModel',\n",
       " '_ngl_color_dict': {},\n",
       " '_ngl_coordinate_resource': {},\n",
       " '_ngl_full_stage_parameters': {'impostor': True,\n",
       "  'quality': 'medium',\n",
       "  'workerDefault': True,\n",
       "  'sampleLevel': 0,\n",
       "  'backgroundColor': 'white',\n",
       "  'rotateSpeed': 2,\n",
       "  'zoomSpeed': 1.2,\n",
       "  'panSpeed': 1,\n",
       "  'clipNear': 0,\n",
       "  'clipFar': 100,\n",
       "  'clipDist': 10,\n",
       "  'fogNear': 50,\n",
       "  'fogFar': 100,\n",
       "  'cameraFov': 40,\n",
       "  'cameraEyeSep': 0.3,\n",
       "  'cameraType': 'orthographic',\n",
       "  'lightColor': 14540253,\n",
       "  'lightIntensity': 1,\n",
       "  'ambientColor': 14540253,\n",
       "  'ambientIntensity': 0.2,\n",
       "  'hoverTimeout': 0,\n",
       "  'tooltip': True,\n",
       "  'mousePreset': 'default'},\n",
       " '_ngl_msg_archive': [{'target': 'Stage',\n",
       "   'type': 'call_method',\n",
       "   'methodName': 'loadFile',\n",
       "   'reconstruc_color_scheme': False,\n",
       "   'args': [{'type': 'blob',\n",
       "     'data': {PDB DATA HERE}"
      ]
     },
@hainm hainm added the bug label Aug 14, 2021
@hainm
Copy link
Collaborator Author

hainm commented Aug 14, 2021

There is a work around (#948 (comment)) but we still need to fix this bug (we did fix it before).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant