Panorama with a preview and indicator (pic inside)

  • Hello all :) I've got a new panorama project in my mind, I'm trying to achieve something pictured below

    So basically this is what I want to get. A panorama and a preview that would tell me which part of the "big picture" I'm currently looking at (that's what the "indicator" is for). Any ideas how to do something like this? Is it possible? (ok, in theory everything is possible ;) )

  • Hello!

    I don't know how to do this with the krPano own tools (like plugins/layers and some such), but basically all you have to do is display two images centered at the bottom (maybe via a plugin of type image). The first is the whole image, the second is the indicator.

    Now the indicator has to be moved according to the current views horizontal position.
    To do this, just set up an krPano event listener of type 'onviewchanged', where you can read out the current horizontal view of the panorama (something like get('view.hlookat')).
    Now it takes only some percentage calculations between the image size and the value from view.hlookat and you are ready to go.

    Maybe you can take it from here...

    Regards

  • Hmm... Yeah, that sounds doable and smart :) I will try. But in the meantime - if anyone has a different idea, I'm still open to suggestions ;)

    [EDIT]

    Ok, I'll be honest here. I tried to figure out some action/event combo that would make sense, but I haven't figured out anything. I just know It's possible, seeing all the mathematical variables that are available... So I'm still waiting for help if anyone feels like it ;)

  • Ok, it seems I'm missing something :/ I tried with my own panos and It didn't work properly. Then I copied your code letter for letter and tried using it locally (heck, I even downloaded the bar and preloader graphics to be super precise with this one and be sure that I haven't messed up something in a stupid way :P ). After a moment of rotating the view I ended up with this:

    The bar travels from the middle of the "preloader" image to the right side of it. Then it returns to the middle, if the rotation is continued. I copied the code without any modifications (except for the parts that point to the preloader and bar image files). I've recently updated to version 1.16 of krpano, and I see that you are using 1.15, however I doubt that that is the thing that's at fault here. On the other hand, there are no other differences! The example pano running from your server is fine, I'm really confused here :O If you still have some patience, please help Umalo :)

  • Hi,

    I've recently updated to version 1.16 of krpano, and I see that you are using 1.15, however I doubt that that is the thing that's at fault here.

    Yes, this bug is unfortunately related to the 1.16 version (and was happing also in all older html5 version)...

    The reason is the mod() action with negative values - it produces wrong results.

    In version 1.16, html5 and flash sharing internally the same code base for the actions, and so this html5 bug was transfered to the flash version.

    In the next krpano release (1.16.2) this will be fixed.

    As workaround you could use this code - a slightly modified 'move_bar' action:

    Code
    <action name="move_bar">
      copy(n, view.hlookat);
      add(n,180);
      if(n LT 0, add(n,2147483520));
      mod(n,360);
      sub(n,180);
      div(n,360);
      mul(plugin[bar].x, n, pic_width);
    </action>

    Best regards,
    Klaus

Participate now!

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