Show panorama before includes?

  • Hi, I have a panorama, which includes a serverside generated hotspots.xml containing (duh) hotspots. But since there is some authentication required, it takes a few seconds to load. Is it possible that krpano will show the panorama, and then adds the hotspots as soon as its done?

  • Hi,

    no, that's not possible - all xml and included xml files were loaded before the viewer itself starts,
    that's necessary because the xml whole data structure needs to be complete before it will be parsed and resolved to the internal data structures,

    a solution for this kind of requirement might be using a small Actionscript plugin or an external Javascript that loads the hotspots data and then adds them dynamically by using the addhotspot action,

    e.g. make an action like this for adding the hotspot and to set all the hotspot attributes you need:

    Code
    <action name="addhs">
      addhotspot(%1);
      set(hotspot[%3].url, %2);
      set(hotspot[%1].ath, %3);
      set(hotspot[%2].atv, %4);
      set(hotspot[%3].onclick, %5);
      ...
    </action>

    and then let your server return the hotspots as string in that format (received by a plugin or by a Javascript):

    Code
    addhs(spot1, 'spot1.png', 0, 0, trace('spot 1 clicked'); );
    addhs(spot2, 'spot2.png', 30, 0, trace('spot 2 clicked'); );
    addhs(spot3, 'spot3.png', 60, 0, trace('spot 3 clicked'); );
    ...

    and send this code at once to krpano with the 'call' interface:
    https://krpano.com/docu/plugininterface/#call
    https://krpano.com/docu/js/

    best regards,
    Klaus

  • I already have a REST API implented that gives me a json of all hotspots, so the javascript method I already tried, I ran some tests, and if I add more then 500 hotspots dynamicly, I get an onverload issue. Through static xml I could add about 1500. Putting a wait or delayedcall is not a solution either (you see the panorama slowly being populated with all the hotspots, 1000 hotspots would take 1-2min to appear).

    Would it be possible to have an onstart action that has a delayedcall that loads an xml?

    Code
    action name="onstart">
      delayedcall(4, loadpano(hotspots.xml,null, MERGE|KEEPALL|KEEPSCENES|KEEPVIEW)
    </action>

    I had some various results, mostly the panorama completely dissapearing and showing the spots in black.

Participate now!

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