• i need to get mouse position coordinates x and y relative to display. for example x 40px y 20 px from lefttop, via javascript.
    As this example "var hlookat = Number( krpano().get("view.hlookat") );" i try with something as.. "var mouse = Number( krpano().get("control.xxxx") );"
    but in the documentation there is nothing about position . could some one help me? thank you.

  • Hi,

    getting the current mouse screen position is currently not possible via the get-interface,
    maybe in one of the next version,

    but note - the flash <-> javascript interface is slow!
    it shouldn't be used high-frequently (for example for mouse position checking)

    what do you want to do with the mouse position?
    mabe it could be done also in a other way...

    best regards,
    Klaus

  • i spend a lot of time to try as in documentation js/javascript xml file: .... on click="js(jstest, hello from xml)" is wrong - correct is on click="js(jstest(hellofrom xml))" to send params via javascript..

  • Hi,

    you're right!
    sorry, I mixed up something in the js() documentation.

    I have updated the documenation now:
    https://krpano.com/docu/actions/#js


    about the mouse position - here is a very small plugin, that's let you access the mouse position:
    jsmouse.zip
    (flash source code also included)

    include this plugin in the xml with:

    Code
    <plugin url="jsmouse.swf" />

    then from javascript you can get the current mouse position with:

    Code
    var krpano = document.getElementById("krpanoSWFObject");
    var mousex  = krpano.get("mouse.x");
    var mousey  = krpano.get("mouse.y");

    here is the flash source of this plugin for better understanding:

    best regards,
    Klaus

  • thank you for your attention and fast solution.
    I have now a very strange problem.
    i'm trying your example of javascript functions. it run perfect in 2 computers and and on a mac. but in others 2 computers i have this message:

    "krpano().call is not a function
    file:///C:/Documents%20and%20Settings/User/Desktop/vacanzemare/giardini/index_tool.html#
    Line 187"

    same files, same folders, same 1.0.8 swf... same!
    do you think somethink about it?
    Thank you again.

  • i think is not that problem i see the panos and the actions and function inside xml files are running. just javascript don't run.
    it seem that the first command :
    "function krpano()
    {
    return document.getElementById("krpanoSWFObject");
    }"
    is wrong or not read so the message is krpano().call is not a function.

    i also change it in var krpano=
    document.getElementById("krpanoSWFObject");
    and done the correction krpano.call .. it run in the same computer and not in the others two.

    very very strange. only 2 computers. with ff3 and ie7 i tryed to change flash version 9 - 10 reinstall ff3 .. nothing.

    and obviusly i must work on that 2 computers.... *cursing*

    thank again for help .

    Suggestion: is possible to create an attribute as <group name="xxxx"> plugin1,plugin2,plugin3,....</group>
    so with only a set will be possible change parameters of a group of plugins ex: set(group[xxxx].visible,false) l

  • Hi,

    yes, the security settings affect only "Javascript" and "plugins with webaccess" like the Googlemaps plugins!
    everything else will work normally,

    or - try the same example on a server, then there should be a problem

    Quote

    Suggestion: is possible to create an attribute as <group name="xxxx"> plugin1,plugin2,plugin3,....</group>
    so with only a set will be possible change parameters of a group of plugins ex: set(group[xxxx].visible,false) l

    I will think about such, at the moment it's only possible to hide all plugins/hotspot at once via
    "hotspot.visible" and "plugin.visible"

    best regards,
    Klaus


  • about the mouse position - here is a very small plugin, that's let you access the mouse position:
    jsmouse.zip
    (flash source code also included)

    Hello

    I am using jsmouse with some php scripts to add hotspots to database and later generate panorama's xml.

    I set lookat_interval = setInterval( 'getlookat()',1000 ); to see what happen and i can't get javascript to read only the position which i need. If i move mouse out of preview position is still updatep.

    so.. is there any method to get the position after mouse click ? (not instantly).

  • I am a bit slow on the uptake.. *cry*

    I do not know if I have done this right..

    I am trying to use kolor ptp to achieve a mouse xy location reference by clicking anywhere on the pano to get the exact location to place a hotspot goto button etc..

    looks like this thread is a bit old but better late than never.. *rolleyes*

    I have downloaded the plugin and added that to my xml..

    I have also placed the js into my html page and tried it in the head and body... But.... *blink*

    So.. what am I doing wrong.. I have used the krpano update tool to update my files.

    Destiny..


    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Virtual Tour generated by Panotour</title>
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <style type="text/css">
    @media only screen and (min-device-width: 800px) { html { overflow:hidden; } }
    * { padding: 0; margin: 0; }
    html { height: 100%; }
    body { height: 100%; overflow:hidden; }
    #container { height: 100%; min-height: 100%; width: 100%; margin: 0 auto; }
    </style>

    <script>
    var krpano = document.getElementById("krpanoSWFObject");
    var mousex = krpano.get("mouse.x");
    var mousey = krpano.get("mouse.y");
    </script>

    </head>
    <body>


    <script src="swfobject/swfkrpano.js"></script>
    <div id="container">
    <div id="panoDIV" style="height:100%;">
    <script>
    embedpano({target:"panoDIV",swf:"virtualtour.swf"});
    </script>
    <noscript>
    <div id="tour">
    <object width="100%" height="100%">
    <embed src="virtualtour.swf" width="100%" height="100%" allowFullScreen="true"></embed>
    </object>
    </div>
    </noscript>
    </div>
    </div>
    </body>
    </html>

    Sometimes I might come across as being stupid; But I have an IQ of 137 *tongue*

  • Hi,

    looks like this thread is a bit old but better late than never..

    Yes, this thread is really old and very-outdated!

    You don't need any external Javascript or plugin for this.

    There are the mouse.x, mouse.y variables:
    https://krpano.com/docu/actions/#mouse.x
    to get the 2d screen position of the mouse,

    and there are is the screentosphere() action to convert screen positions to spherical coordinates:
    https://krpano.com/docu/actions/#screentosphere


    Providing an exact usage example would presume to know what you are trying to do...
    but maybe have also a look into the examples from the krpano viewer download package,
    e.g. these ones:
    https://krpano.com/examples/10815…se/jsmouse.html
    https://krpano.com/examples/10815…e-hotspots.html

    Best regards,
    Klaus

  • Oh Klaus.. I really want to marry your brain.. You are just amazing for sure.. *g* You make things look so easy yet I burn my brain cells up trying to work out simple stuff.. *cry*

    This url here is the exciting one.. https://krpano.com/examples/10815…e-hotspots.html

    I think Its giving me what I am looking for but... I will be picking your brain more on this.. *thumbsup*

    Destiny...

    Sometimes I might come across as being stupid; But I have an IQ of 137 *tongue*

  • Dear Klaus

    It has just become apparent to me that I am unable to interact with this krpano test.. https://krpano.com/examples/10812…se/jsmouse.html The coordinates move but not the pano....

    Others can pan the pano using Windows with different browsers.. I am using a Mac with Safari but it will not rotate.. I tried it with Opera and it works fine... Since it did not pano I was under the impression that it did not until I was made aware something was wrong..

    Thank you

    Destiny..

    Sometimes I might come across as being stupid; But I have an IQ of 137 *tongue*

  • Ich habe die Anweisungen befolgt, sehe aber keine Koordinaten-Anzeige.

    Ich habe die jsmouse.swf in den vtour-Ordner (enthält die tour-xml) kopiert und die Zeile <plugin url="jsmouse.swf" /> in die tour.xml eingefügt.

    Was muss ich noch machen, um die Koordinaten zu sehen?

    Grüße

    Panox

  • Hi,

    auf welche Anweisungen beziehst du dich und wo soll die Anzeige in deinem Fall erfolgen?
    In dem 'jsmouse' Beispiel wird die Maus-Position ja nur per Javascript ausgelesen und auf der HTML Seite selbst angezeigt.

    Bzgl. 'jsmouse.swf' - das Plugin ist nicht notwendig, krpano hat seit ein paar Jahren die mouse.* Variablen direkt integriert.

    Schöne Grüße,
    Klaus

Participate now!

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