I'm doing something like you said: var checkHover; function hoverCallback(a,b,c,d){ if(checkHover) clearInterval(checkHover); var res = b.split('.')[0];//get everything until first "." Jmol.script(myJmolOb, 'select '+ res +' ; halo on;'); checkHover = setInterval(function() { Jmol.script(myJmolOb, 'select '+ res +' ; halo off;'); }, 1000); }
What I did is, every call I cancel the setInterval, then I set the highlight (I'm using halo on here) and finally I start setInterval again. So in the last call (when I move out) the setInterval will not be canceled being called after 1 second. It's working. That's really how hovercallback works? This behavior to keep calling the listener also to do not call when move out? On 3 August 2015 at 09:27, Ron Mignery <remign...@gmail.com> wrote: > Am 02.08.15 um 20:34 schrieb tremato...@gmail.com: > > Hi, > > > > I'm trying to create a highlight effect when the user keeps the mouse > > over a residue, so besides the label I'm also changing the residue color. > > I'm using hoverCallback to set the color but I also need a hover out to > > set the color back to the original. > > > > 1. Is there a 'hover out' callback or other way to achieve this? > As far as I remember the 'hover' callback is fired on both events: 'in' > and 'out'. If you keep track what happened at the last call of your > callback function you will be able to restore what was done. > > 2. How can I get the current colors from a residue, for example, get the > > colors from [SER]679:B.CA <http://b.ca/> <http://B.CA <http://b.ca/>> ? > > > Perhaps you could set a timeout in the callback slightly smaller than the > hover callback repeat interval and clear the highlight when it timed out. > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Jmol-users mailing list > Jmol-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jmol-users > >
------------------------------------------------------------------------------
_______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users