Sie sind nicht angemeldet.

noupunt

Schüler

  • »noupunt« ist der Autor dieses Themas

Beiträge: 47

Wohnort: Barcelona

Beruf: Photographer and full stack developer

  • Nachricht senden

1

Donnerstag, 12. Mai 2022, 18:04

accessing to embed krpano from layer type="krpano"

Hello!
My question is:

In an embed krpano [E-Krpano], i made a krpano layer [L-Krpano] that show a diferent tour like this:

Zitat

<layer name="new_pano"
width="200"
height="200"
align="center"
type="krpano"onloaded="krpano.actions.loadpano('%FIRSTXML%/other_krpanos/primera/tour.xml');"
/>
To control L-krpano from E-krpano i make like this in 'normal' krpano language:

Zitat

layer[new_pano].krpano.actions.removelayer(whatever);
So... I've access to the layer krpanointerface like this: 'layer[new_pano].krpano'

Then, to control E-Krpano from the L-Krpano, there is any way in 'normal' krpano language to access to the parent krpano-interface? or only it can be made using Javascript like this:

Zitat


js(krpano.set('whatever','hello'));


thanks so much!!

2

Samstag, 14. Mai 2022, 10:46

Hi,

it depends on what you want todo...
Some things are possible also just with actions but some require using Javscript.

But generally for interaction with a krpano layer I would recommend using Javascript, e.g. in an type="javascript" <action>.

Best regards,
Klaus

noupunt

Schüler

  • »noupunt« ist der Autor dieses Themas

Beiträge: 47

Wohnort: Barcelona

Beruf: Photographer and full stack developer

  • Nachricht senden

3

Samstag, 14. Mai 2022, 17:36

Ok! thanks for the answer, Js then!

By the way, is there any way to "focus" on that layer once is created? so don't need to click on it to be able to use wekyboard actions to the krpano layer for example?

thanks!!!

4

Dienstag, 17. Mai 2022, 14:30

Hi,

Zitat

By the way, is there any way to "focus" on that layer once is created?

In krpano 1.21 there will be an option for this, but for the current version try this Javascript code in the onloaded event:

Quellcode

1
2
layer.sprite.focus();
window.activekrpanowindow = layer.sprite;


Best regards,
Klaus

noupunt

Schüler

  • »noupunt« ist der Autor dieses Themas

Beiträge: 47

Wohnort: Barcelona

Beruf: Photographer and full stack developer

  • Nachricht senden

5

Mittwoch, 18. Mai 2022, 17:48

Hello!

I've been trying your code without success... :-) may be there is something I'm doing wrong...

https://www.sergigomez.com/krpano/test_key_focus/index.html

main xml:[url]https://www.sergigomez.com/krpano/test_key_focus/tour.xml[/url]
krpanolayer xml: http://localhost/pascua/tests_krpano/tes…p_tour/tour.xml

Just to chek if I'm missing something!

what I want to do is: If you click to the button and press a key, trigger the krpano layer event keydown&keyup (without haveing to click on the new layer before).

Any way, if the next version this will be incorporated I can wait, I'm just trying things now.

thanks!!!

And, related with the topic of this thread:

To comunicate from krpanoLayer to mainKrpano via javascript, what I do is:

in the main krpano, in a javascript function autorun="onstart":

Quellcode

1
 window.krpanoexternal = krpano


and then in the krpano layer xml I can work with:

Quellcode

1
krpano.actions.set(...) // points to krpanoLayer
and

Quellcode

1
window.krpanoexternal.actions.set(...) // points to main Krpano
Is this the only way, or there is any other way to control main krpano from krpano layer?

thanks!!

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »noupunt« (18. Mai 2022, 20:10)