Beiträge von dancoder

    Thanks for the suggestions (and sorry for the late reply).

    As Tuur suggested I'm using a key event for this. Pressing the 'h' or 'H' key will create a hotspot.
    I'm also using a double-click event (2 click events within a certain time).

    Code
    <events name="addHotspotEvent"
            onclick="js(panoramaClicked())"
            onkeyup="js(panoramaKeyed())" />

    Excellent news about the new variables *thumbsup* , I will be looking forward to it.


    Best regards
    Dan

    Hi.

    I use the HTML5 viewer (krpano 1.18.5) and have a context menu option for adding a hotspot.

    Code
    <contextmenu>
      <item name="addHotspotMenuItem" caption="Add hotspot" onclick="js(createHotspot())"/>
    </contextmenu>

    In my JavaScript file I have a function to handle the hotspot creation.

    Code
    function createHotspot() {
        var krpano = document.getElementById("krpanoViewer");
     
        var mx = krpano.get("mouse.x");
        var my = krpano.get("mouse.y");
        var pt = krpano.screentosphere(mx, my);
     
        window.external.HotspotCreated(pt.x, pt.y);
    }

    The problem is that the mouse point is the where the mouse is at the moment that the context menuitem is clicked.
    I need to get the point where the right-click was as this should be the hotspot point.
    How is this best done?

    A related question.
    In addition to a using context menu for adding a hotspot it would be a nice feature to use a double-click event for adding the hotspot. Is this possible 'out-of-the-box' or is a plugin necessary for handling double-click events?

    Thanks.

    Best regards
    Dan