General cleanup of the frontend js code
The current js code is a mess. Some specific issues:
-
it should use the json API to get information about the panorama to display, instead of using javascript variable generated from a template.
-
it is primarily designed for 360° pictures, and does not handle non-360° pictures very well (see issue #1).
-
it implements its own tile display logic, while there probably are libraries to do that.
-
there are multiple systems of coordinates, with conversions between them:
- the backend uses absolute pixel coordinates (x/y) to refer to points in an image.
- the frontend uses relative coordinates (x between 0 and 1, y between -0.5 and 0.5) to refer to points in an image.
- the frontend also uses screen-based coordinates, in pixels. The relation between screen coordinates and image coordinates depends on the zoom level and the current position in the image, and wraps around for 360° images.
- both frontend and backend also manipulate azimuth and elevation (but that's the point of celutz)