hotspot coordinates on the screen to use them in js code

  • How to get current coordinates of hotspot that depend on current view? I mean x and y not ath, atv. Then how to display them to let me read them. I have been doing sth like that in javascript:

    Code
    alert(myVariable);

    How to send them to javascript funcion.

    I need this help because my js code should display an information iframe box that should be positioned in a certain distance from hotspot on click event.
    Thank you

  • Thanks for the advice, Andrey. I try to use that function but not succeeded yet. What could be wrong in that code:


    The last line (with onhover) displays just the code not screen coordinates values as I expected.

    EDIT------------------------------------------------------
    it nearly worked but I cannot make showtext display both coordinates but one.
    So that worked:

    Code
    <action name='showCoor'>
     		spheretoscreen(ath,atv,q,w);
     		showtext(get(q));
    	</action>


    and that not:

    Code
    <action name='showCoor'>
     		spheretoscreen(ath,atv,q,w);
     		showtext(get(q) + ' ' + get(w));
    	</action>


    Any ideas?

    EDIT-----------------------------------------
    I've managed it succesfully:

    Code
    <action name='showCoor'>
     		spheretoscreen(ath,atv,q,w);
     		txtadd(e ,get(q),'___',get(w),);
     		showtext(get(e));
    	</action>


    Thank you

    Edited 6 times, last by trzczy (March 23, 2014 at 3:01 PM).

  • hi!
    well, you make a lot of errors :)
    krpano actiona can't calculate variables directly in actions.
    for example
    showtext(x + y); is not possible
    showtext can show an variable or text
    so you need to do so
    txtadd(new_text,get(x),' ',get(y));
    result is text as new_text variable value.
    and you can't call actions in attributes or in actions

    Andrey

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!