David,

OK, so the beauty of this system is that you can implement any sort of
additional functionality you want using readily available methods that have
nothing to do with Jmol or JSmol. It's one of the bonuses of working in
JavaScript and jQuery.

So, for example, if you want to implement a key listener that implements  +
and - to actuate zooming, you can do it this way:

c = $("#jmolApplet0_canvas2d")
c.attr("tabindex", 1)
c.mouseover(function(){c.focus()})
c.keypress(function(e){
  if (e.key == "+")Jmol.script(jmolApplet0, "zoom *1.2")
  else  if (e.key == "-")Jmol.script(jmolApplet0, "zoom /1.2")
})

Notice that to accept key events, we must (a) provide a tabindex to the
canvas and (b) make sure the canvas has focus when we are looking for key
events.

I would only say that hidden specialized features like this, though
potentially useful, are not necessarily recommended.
​

Bob
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to