Keeping Current Viewed Scene Problem

  • I've got an issue which I'm sure is quite simple, but my coding abilities are failing me. I've laid out what I need to do in this diagram.

    I am using the same interface that comes with recent versions of krpano (same as here: http://www.krpano.com/tours/paris/ ) Also using the new krpano version="1.16"

    So I've got 5 different locations, each location having x2 different viewing formats. There is a button which will change the current view from regular Pano View to Flat Pano View and vice versa. The current scene (location) which is being viewed must be kept if switching views (e.g. Scene #4 Normal Pano View --> Scene #4 Flat Pano View etc.)

    Clicking the "show thumbs" button will only show the 5 thumbnails of the same view format that is currently being viewed. The "next scene" and "previous scene" buttons also need to function. Maps are not an issue.

    I would not want to change URL location, but can use multiple xml files to achieve this. I have kept pretty much the same code as in the tour.xml and skin/vtourskin.xml that come with recent versions of krpano.

    ---
    Basically, what is the best way of programming the "switch view" button for the "onclick" function which will keep the currently viewed scene (and also update the thumbnails correctly etc)? Previously I would have semi-cheated by making several versions of the same button and just loading a new version in each scene. However I need a more elegant dynamic xml solution in this instance. I think it may be something to do with "get scene index" but all of my testing and forum searching haven't worked. As things stand, I am able to change the view format back and forth but can only start at scene index 0 each time.

    As ever, any suggestions very much appreciated.

    Malcolm

  • I have been trying:

    onclick="loadpano(01-equiview-5scenes.xml,get(xml.scene),KEEPSCENES|KEEPDISPLAY|KEEPPROGRESS|IGNOREKEEP);"


    (new xml now loaded)

    <krpano version="1.16" onstart="startup();">

    <action name="startup">
    loadscene(??);
    </action>


    I'm just not able to fully pass the current scene value from the "onclick" in one xml to the "loadscene" function in the newly-loaded xml. The skin reloads correctly keeping the current scene but the actual preview/pano images won't load.

    Absolutely stuck on this one.

  • OK I'll simplify this. How can I get the current code to work? I know having multiple "if" actions for the same "onclick" call isn't ideal but I can tidy that later. As things stand, when I click the "switchviewbutton" in the interface, nothing happens. The paths etc. are all correct, when I take out the "if" bit of the code the loadpano works correctly.


    ---EDIT---

    Finally found a solution:

    Code
    onclick="if(scene[get(xml.scene)].index == 0,loadpano(01-equiview-5scenes.xml,null,MERGE));
    	         if(scene[get(xml.scene)].index == 1,loadpano(02-equiview-5scenes.xml,null,MERGE));
             	if(scene[get(xml.scene)].index == 2,loadpano(03-equiview-5scenes.xml,null,MERGE));"/>

Jetzt mitmachen!

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