changing scenes via javascript

  • So I'm having difficulty doing something that seems rather easy. I know within the krpano, it's easy to put hotspots and move to other hotspots. Well I have a map outside of the krpano and I want to make a javascript call to the krpano to change the scene. Sounds simple, right? I've tried two different strategies, both of which are giving me problems. The first one, loads up a new krpano each time i call selectpano(id):

    This seems to not be good after a while of navigating from pano to pano to pano. It just gets bogged down and slows significantly after extended use. So I tried another method. This one keeps the same krpano, but just changes the scene within it. *Conceptually* this seems like it's more light weight:

    But I get the same problem here. In the beginning it takes about 4-5 seconds to load the pano on the selectpano(id) call. Each subsequent call of that function for a different pano slows the load time until, ultimately, the showpano() (the function that gets called after the loadscene call is completed, never gets called.

    Can somebody help me? It seems that changing scenes via javascript should be a very fundamental and easy thing to accomplish. What am I doing wrong? Has anybody else run into this problem before?

  • Yeah, I guess that's a good idea :)

    Here's the link:
    http://archive.cyark.org/iphone/sat.php

    It obviously wasn't meant to display in safari as an end product, but it works the same. Just click Virtual Tour, then select one of the missions, and then select a blue dot to load a pano. It takes forever to load. If you want to view the js file, it is at:

    http://archive.cyark.org/iphone/includes/application-sat.js

    Hopefully this can help shed some light on my problem .....

  • Well I disagree with that statement. That's not that much code at all. All of it is necessary. And most of the functions don't even get called until the user specifically requests that feature. Or, in other words, if the user just goes straight to the pano and doesn't play audio, use the accelerometer/compass, or use gps, most of the javascript isn't even called.

    So, as most of the functions in that js file have nothing to do with the pano itself, they really don't have any bearing on this issue. I just want to know how to change scenes in my krpano object using javascript in a reasonable time. I've attempted to write two selectpano() functions, neither of which perform very well. How can I better write this function?

  • what device is this tour for?
    I tried the iPad and never got into a problem except for the interface.
    on the iphone4, everything is off the screen and the interface doesn't respond even in landscape.
    Oh i see. On the Iphone the tours do not load at all of take freaking forever!
    There must be some memory issue. Try smaller cubefaces or building your interface in krpano instead.. and just utilize the bare bones html. My complex interfaces work fine in krpano..
    You don't really need to use outside js for anything here.. Everything can be done with JS and krpano XML.

  • The app is for ipads and iphones. And I package it with phonegap, so any issues you see with layout are because you're viewing it in safari, not in it's packaged form. There are no formatting/layout issues with this when it gets packaged.

    My images are 1000px square jpgs, and there are six of them (obviously). Is that too big. Would sizing them down improve performance? What size do you use?

    And to your point of building my interface in krpano, my application requires playing/controlling audio, using the hardware to control the view heading (i know krpano can do this), and having a map that is panable and zoomable, among other things. I don't think krpano can do much of this, so how can I build my app in krpano?

  • Well maybe, but you can always send your krpano back to your pan-able zoom-able page.. no need to share memory.

    What do you mean by send my krpano back? Do you mean destroy that object in memory?

    And how exactly do I fix those seams? What causes those? Is there any documentation on this site to fix that? I couldn't find any.

  • I just did both of the suggestions from jarred and sasha.

    I tried the new beta of the js. That didn't have any impact on the seams. Note that my previous version was 1.0.8.14 (build 2011-04-01). So I didn't have a really old version to start with. I didn't really notice any other changes in my brief demoing of it

    I also tried to downsize my images from 1000px to 512px. I did notice *some* improvement in load time. Previously, with the 1000px images, it took perhaps 5 seconds to load the new pano. With the 512px images, it took maybe 4 seconds. So that doesn't give me the mammoth improvement I'm looking for. How can I load these panos faster? Or is this pano viewer supposed to take a handful of seconds to load a pano?

Participate now!

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