The development of Photo Sphere Viewer is far to be dead. Version 2.3 is only one month old, but here is version 2.4 which comes with seven new options and three new public methods.

Control the vertical animation!

Since some versions, it’s possible to control the horizontal animation speed. However it wasn’t possible to choose the vertical speed. Now, it is, with a new option: vertical_anim_speed which accepts all the values accepted by anim_speed (for the horizontal speed).

Also, it’s possible to select the target of this vertical animation with vertical_anim_target. You indicate to this option a latitude, in radians or in degrees. When the animation starts, the vertical part will go to this latitude. By default, the user will always return to the equator but, now, you can change this.

Hide a part of your panorama

The biggest new feature of Photo Sphere Viewer 2.4 is the possibility to select the longitudes to see. You can in fact indicate a minimal and a maximal longitude to see with min_longitude and max_longitude. These values can be in radians or degrees. These options are useful if you want to hide a part of your panorama for some reasons.

But, what about the horizontal animation? What happens to it when the edge of your allowed zone is reached? Good question.

To answer to this question, what’s better than a new option? Named reverse_anim, this option is a boolean. If it is set to false, the animation will stop if the edge is reached. But you can set it to true, which is its default value. If it’s the case, then the animation will be reversed. You can now say “no” with a virtual head.

Defining minimal and maximal longitudes can also be useful if your panorama is not complete. But, for now, Photo Sphere Viewer can’t detect these cropped panoramas (unless they are taken with Google’s Photo Sphere).

That’s why you can define your own values with pano_size. This option is an object which can accept six properties:

  • cropped_width and cropped_height: the cropped panorama size (if this size is the image one, you can forget these properties);
  • full_width and full_height: the size your panorama should be if it wasn’t cropped;
  • cropped_x and cropped_y: the coordinates of the cropped part relative to the full panorama (if the cropped part is centered you can forget these properties).

A new type of loader

Photo Sphere Viewer 2.4 comes with a third type of loader. You can still choose a simple text loader and an image one. Now, you can go further and indicate an HTML loader with loading_html.

You can indicate to this option a string representing the DOM tree to insert during the loading. You can also indicate it a DOM node to append.

A concrete example can be seen in the example1.html file, with a very simple HTML loader, animated with CSS.

Control the position!

If that’s a thing you want, you can force the user to see a specific point of your panorama with the new public method moveTo(). Pass it the coordinates of a point, and the user will see it.

You can also retrieve the point on which the panorama is currently centered with getPosition() which will gives you the coordinates of the point in radians. Degrees are available with getPositionInDegrees().

Some fixed bugs

The fullscreen feature was broken on Internet Explorer. Now, it’s fixed, so your users using IE can view your panoramas in fullscreen.

There still was a problem with box-sizing on some websites. It seems like some developers don’t like inherit as a value for box-sizing, so I fixed the navigation bar elements for these websites.

Now, the weird bug. In the example1.html file, I propose a file input to allow the uploading of a panorama, displayed with Photo Sphere Viewer. It seems like, only on some browsers and on some platforms, it doesn’t work. I found the problem: these browsers don’t like AJAX with local files.

However, I don’t see any way to fix it, but you shouldn’t see this problem again. In fact, now, when PSV sees a local file, it skips the AJAX function. So, problem solved? Not really…

If the AJAX function is here, it’s not for nothing, and it’s not useless: this function reads XMP data, and these data are used by PSV to see if the panorama is cropped, if it is taken with Google’s Photo Sphere.

If your panoramas are not cropped, the AJAX function is useless (that’s why the usexmpdata option is here). If you want to use local cropped panoramas, it’s still possible, but you must indicate by yourself the right sizes with the new pano_size option. I know that it’s not perfect, but I didn’t find a better solution.

What’s next?

Still no 3D renderer in this version? Yeah, that’s normal, as it’s not ready. However, I began developing it, and, for now, the progress is good. I had some troubles and I think others will come, but it’s a very interesting thing to develop, and I won’t give up.

I don’t know when this new renderer will be ready. The only thing I can say is that you have no chance to see it in the next few days.

This new renderer won’t come alone in a new version. It will be here for Photo Sphere Viewer 3.0, a version that will change a lot of things, mostly invisible for you, but important for the development. Photo Sphere Viewer 3.0 will be a very big update, that’s why you can be sure that it will take a while to develop.