You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, October 28th 2019, 2:34pm

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!

2

Monday, October 28th 2019, 5:51pm

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:

Source code

1
2
3
4
5
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

3

Monday, October 28th 2019, 8:23pm

Awesome! Thank you Klaus!

Greetings!