Addressable <layer>s

  • Ultimately I'm seeking the ability to address a layer( <div> ), via the DOM, that has been created by KRPano in HTML5 mode.

    Background:
    In HTML5 mode, a layer seems to be translated into a <div> that has no id or name associated with it.
    Here is an example:

    The following KRPano <layer> element...
    <layer name="testlayer"
    type="container"
    keep="true"
    visible="true"
    enabled="true"
    zorder="1"
    align="bottomleft"
    x="120" y="0"
    width="100"
    height="20"
    bgcolor="0xCCCCCC"
    bgalpha="0.5"
    >
    </layer>

    Translates to a <div> in HTML5 mode...
    <div style="position: absolute; z-index: 3002; overflow: visible; cursor: default; pointer-events: none; opacity: 1; background-color: rgba(204, 204, 204, 0.498039); width: 100px; height: 20px; -webkit-transform: translateZ(1000000000000px) translate(120px, 678px) translate(-50px, 10px) rotate(0deg) translate(50px, -10px); background-size: 0px; background-position: 0px 0px;"></div>

    The fact that it has no NAME or ID associated with it makes it nearly impossible to access via the DOM.

    I'm not so interested in begin able to manipulate most aspects of the <div> but I am interested in being able to inject raw HTML into the innerHTML attribute via AJAX.
    If the <div>s created by KRPano had a NAME or ID this would be possible.

    Or is this possible now? *confused*

  • Hi,

    see here:
    https://krpano.com/docu/xml/#layer.sprite

    Btw - using innerHTML would be NOT recommend - this would remove also all children elements of the element and could also break some events and might be also problematic for some other cases - better create a new html element and add it via appendChild.

    Btw2 - the best solution for your request (inject raw HTML) might be a small js plugin - see here - in the example code there a new html element (a canvas element in the example) also was added via appendChild:
    https://krpano.com/docu/plugininterface/#js

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!