[Chimera-users] Center on surface at mouse accelerator
Tom Goddard
goddard at sonic.net
Wed Aug 30 18:10:25 PDT 2017
Hi Dan,
Thanks for the code. You know ctrl-click with the right mouse button centers on the clicked atoms? It also centers when you click on a surface, but it uses the center of the entire surface instead of the point you clicked on. It seems like it would be more useful to center on the surface point you clicked on so I changed the code to do that — will be in tonight’s Chimera builds. I think this is better than using a keyboard shortcut since few people enable the keyboard shortcuts.
Tom
> On Aug 30, 2017, at 11:44 AM, Daniel P Farrell wrote:
>
> Hello,
>
> I found myself constantly needing to re-center on different regions of EM density maps, and I was originally just dropping spheres on the surface, centering on those, then deleting them. Finally I got sick of that and wrote this. It will center the window on the surface of whatever surface the mouse is currently overlaying.
>
> I found this to be a very helpful addition when looking at large EM maps, and was thinking other people might too, after using it for a while I feel as though it could be part of trunk since I use it so much.
>
>
> basically it would require the addition of this to standard_accelerators.py
>
> ... other accelerators..
>
> ('zx', 'Center view on surface where mouse is located', center_on_surface_at_mouse),
>
> ... zx because it's close to where you rest your hands on the keyboard...
>
> def center_on_surface_at_mouse():
> from chimera import selection, tkgui
> hits = []
> w = tkgui.app.graphics
> x = w.winfo_pointerx() - w.winfo_rootx()
> y = w.winfo_pointery() - w.winfo_rooty()
> from Surface import surface_models
> import VolumePath.tracer as tracer
> hits.extend(tracer.surface_intercepts(x, y, surface_models()))
> xyz, model = tracer.closest_hit(hits)
> print(xyz)
> if xyz:
> print('cofr %f,%f,%f' % (xyz[0],xyz[1],xyz[2]))
> chimera.runCommand('cofr %f,%f,%f' % (xyz[0],xyz[1],xyz[2]))
> chimera.viewer.camera.center = xyz
>
> cheers!
> ~Dan
>
>
>
>
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
More information about the Chimera-users
mailing list