that's it. Could take some ingenuity, but it seems possible to me. Here is
a way to get the coordinate displayed on the document tab of the browser.

Jmol.script(jmolApplet0,"set hoverCallback 'myHover';*hover off*")
myHover = function(appletID,label,index){
  var app = Jmol._applets[appletID];
  var atom = app._applet.viewer.ms.at[index];
  var isAntialiased = app._applet.viewer.antialiased;
  var sx = atom.sX * (isAntialiased ? 0.5 : 1);
  var sy = atom.sY * (isAntialiased ? 0.5 : 1);
  var offset = $(app._canvas).offset();
  offset.top = Math.floor(offset.top + sy);
  offset.left = Math.floor(offset.left + sx);
  document.title = JSON.stringify(offset)
}

Notice that we are tapping into JSmol in a way that is not possible in Java
-- going straight into the variables. This is faster, but I don't generally
recommend this.

There is a bug in Jmol right now that when you turn  hover off, it does
turn off the callback. That is not supposed to happen. I found the bug, but
it is not available yet, so in the mean time just don't include "hover off"
for now, or, if you want to go into jsmol/core/corejmol.z.js, you can change

a&&(!this.hoverEnabled

to

a&&(!this.hoverEnabled && !this.sm.haveHoverCallback()

yourself.


On Thu, Aug 20, 2015 at 5:08 PM, <tremato...@gmail.com> wrote:

> Hi Robert,
>
> Now I understood your suggestion! Disable at jsmol and do it myself using
> the data from the hovercallback method. Sorry, I was confused.
>
> best regards
> Fausto
>
> On 20 August 2015 at 15:53, Robert Hanson <hans...@stolaf.edu> wrote:
>
>> You will have to turn off the canvas hover that Jmol uses and instead use
>> your own, totally outside of Jmol.
>>
>> On Thu, Aug 20, 2015 at 12:43 PM, <tremato...@gmail.com> wrote:
>>
>>>
>>> I'm trying to get there - where the label is - but as it is inside the
>>> canvas element it's hard to inspect. There is a way with chrome experiments
>>> but I can't put to work here. Anyway I will keep trying.
>>>
>>> Thanks!
>>> Fausto
>>>
>>> On 17 August 2015 at 22:34, Robert Hanson <hans...@stolaf.edu> wrote:
>>>
>>>> In order to do that you will need to learn some CSS and JavaScript. The
>>>> best way to do this is probably with jQuery. But I do not know exactly how
>>>> to do that.
>>>>
>>>> On Mon, Aug 17, 2015 at 10:10 AM, <tremato...@gmail.com> wrote:
>>>>
>>>>> Hello Robert,
>>>>>
>>>>> Thanks for your explanation, I have been thinking about it but I still
>>>>> didn't realize how to do it. Could you tell me what kind of return this
>>>>> callback needs to give to change the hover label position and style?
>>>>>
>>>>> Have a great day!
>>>>> Fausto
>>>>>
>>>>>
>>>>>
>>>>> On 17 August 2015 at 00:59, amitesh sharma <siprusha...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> please describe me how I use in html.
>>>>>>
>>>>>> Amitesh kumar sharma
>>>>>> Noida Uttar Pradesh
>>>>>>
>>>>>> On Sat, Aug 15, 2015 at 11:56 PM, Robert Hanson <hans...@stolaf.edu>
>>>>>> wrote:
>>>>>>
>>>>>>> sorry --
>>>>>>>
>>>>>>> ​... using jmolApplet0._applet.viewer.ms.at[iatom].sX and ...sY
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> Jmol-users mailing list
>>>>> Jmol-users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Robert M. Hanson
>>>> Larson-Anderson Professor of Chemistry
>>>> Chair, Department of Chemistry
>>>> St. Olaf College
>>>> Northfield, MN
>>>> http://www.stolaf.edu/people/hansonr
>>>>
>>>>
>>>> If nature does not answer first what we want,
>>>> it is better to take what answer we get.
>>>>
>>>> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>>
>> --
>> Robert M. Hanson
>> Larson-Anderson Professor of Chemistry
>> Chair, Department of Chemistry
>> St. Olaf College
>> Northfield, MN
>> http://www.stolaf.edu/people/hansonr
>>
>>
>> If nature does not answer first what we want,
>> it is better to take what answer we get.
>>
>> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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
>
>


-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to