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!!

  • 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

  • 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!!!

  • 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:

    Code
    layer.sprite.focus();
    window.activekrpanowindow = layer.sprite;

    Best regards,
    Klaus

  • Hello!

    I've been trying your code without success... *smile* may be there is something I'm doing wrong...

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

    main xml:https://www.sergigomez.com/krpano/test_key_focus/tour.xml</a>
    krpanolayer xml: http://localhost/pascua/tests_k…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":

    Code
    window.krpanoexternal = krpano

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

    Code
    krpano.actions.set(...) // points to krpanoLayer

    and

    Code
    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!!

    Einmal editiert, zuletzt von noupunt (18. Mai 2022 um 20:10)

Jetzt mitmachen!

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