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