Create hotspots on mouse click event

  • Hi all krpano fans,
    I'm new in KRpano, and I want to add a panoramic view in a website,
    I already managed to do that for the 'user-view', now I try to add an admin page for my panorama,
    where I will add/remove hotspot with onclick event of the mouse.
    I found the editor plugin but it didn't do exactly what I want, so I started to develop my own plugin in Javascript.
    My problem is, when I try to get the mouse coordinates of the click event when I add hotspot,
    In my plugin :

    and in my XML I have :

    Code
    <events onclick="plugin[myplugin].edithotspot('mouse')" />

    But when I try that the coordinates show in the logs have one click late,
    first clic : null, null
    second click : ath of first click, atv of first click
    third click : ath of second click, atv of second click
    ...

    Anybody knows where I'm wrong ?

    Note :
    in the code addclicked/delclicked are two boolean variables activate when I click on "add hotspot" or "remove hotspot" buttons

    Thanks for help
    sorry if my english is bad I'm french

  • Hi,

    the 'call' interface isn't synchronous, that means it's not guaranteed that the given actions will be directly processed after calling.

    But you can call screentosphere() function also directly in plugins - see here:
    https://krpano.com/docu/plugininterface/#krpanointerface

    e.g.

    Code
    var mx = krpano.get("mouse.x");
    var my = krpano.get("mouse.y");
    var pt = krpano.screentosphere(mx,my);
    krpano.trace(1, "mouse="+mx+"/"+my+" pano="+pt.x+"/"+pt.y);

    Best regards,
    Klaus

  • Hi guys,

    I returned after a little period of work with Krpano
    it's really a nice tool

    I add some new ideas to my plugin but one keep blocking me,

    I though of a way for the user to add hotspot dynamically with mouse clicks,
    all the hotspots added/removed are stored in an multi-dim array with all their parameters (position, name, style,...), this array is transfered to a php script and I modify the XML file with DOM to create/remove hotspots.
    But currently the onclick parameter need to be set in the XML file (loadscene(...)) a la mano,

    a simple idea to me was to popup a combobox on mouse position with the list of all scenes, so the user can choose which one to open with the created hotspot

    I already manage to create a combobox (with jQuery) and pop it on mouse position,
    the problem is when I need to specify the onclick action inside my <option> tag,
    I cannot reference one of my plugin methods because they are private

    so my question is :
    Can we (by any means) call a plugin methods outside the panorama xml or plugin.js file ?


    I tried the combobox.js plugin with krpano, and this can be a great answer to my jquery combobox problem
    but I can't manage to pop the combobox on my mouse cursor

    Thanks for help
    and tell me if more informations is needed

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!