Get access to layertoscreen global function from krpano object?

  • Hello,

    How can I get access to global function "layertoscreen" from own plugin in krpano? I suppose that this function was missed :)
    When i call this:


    function krpanoplugin() {

    let local = this;
    let krpano = null;

    local.registerplugin = function(krpanointerface, pluginpath, pluginobject) {
    krpano = krpanointerface;

    // INTERESTING POINT
    krpano.screentosphere // this is a function, it's okey :)

    krpano.layertoscreen // undefined, it's not okey ;/
    }
    }

    In documentary:
    https://krpano.com/docu/actions/#actionsreference the action should be access, am i right?
    I need to convert layer x, y to spherical coordinates! Do you know any workaround for that??

    Greetings!

  • Hi,

    that 'layertoscreen' is an action and mainly designed for usage from actions.

    It would be callable from JS via krpano.actions.layertoscreen, but as it is an action it works with krpano variables.
    So to call it, the variable would need to be set before and get after the call.

    Here an example:

    Code
    krpano.set("layerx", ...);
    krpano.set("layery", ...);
    krpano.actions.layertoscreen("layername", "layerx", "layery", "screenx", "screeny");
    var screenx = krpano.get("screenx");
    var screeny = krpano.get("screeny");


    Btw - the 'screentosphere' is there at the krpano object, because a special version of that action for JS is defined at the object - please see here:
    https://krpano.com/docu/plugininterface/#krpanointerface

    Best regards,
    Klaus

Jetzt mitmachen!

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