diff --git a/lib/sphere.js b/lib/sphere.js index 742b0a9..c3846d1 100644 --- a/lib/sphere.js +++ b/lib/sphere.js @@ -6,9 +6,10 @@ // Usage: new Photosphere("image.jpg").loadPhotosphere(document.getElementById("myPhotosphereID")); // myPhotosphereID must have width/height specified! - -function Photosphere(image){ +// 2014-03-03 ericball - added optional vertical field of view parameter +function Photosphere(image, vFoV){ this.image = image; + this.vFov = (typeof vFoV === "undefined") ? 75 : vFoV; //this.worker = new Worker("worker.js"); } @@ -108,7 +109,8 @@ Photosphere.prototype.start3D = function(image){ this.lat = 0; this.lon = 90; this.onMouseDownMouseX = 0, this.onMouseDownMouseY = 0, this.isUserInteracting = false, this.onMouseDownLon = 0, this.onMouseDownLat = 0; - this.camera = new THREE.PerspectiveCamera( 75, parseInt(this.holder.offsetWidth) / parseInt(this.holder.offsetHeight), 1, 1100 ); +// 2014-03-03 ericball - added optional vertical field of view parameter + this.camera = new THREE.PerspectiveCamera( this.vFoV, parseInt(this.holder.offsetWidth) / parseInt(this.holder.offsetHeight), 1, 1100 ); this.scene = new THREE.Scene(); mesh = new THREE.Mesh( new THREE.SphereGeometry( 200, 20, 40 ), this.loadTexture( image ) ); mesh.scale.x = - 1; @@ -147,7 +149,7 @@ Photosphere.prototype.start3D = function(image){ Photosphere.prototype.startMoving = function(){ self = this; this.interval = setInterval(function(){ - self.lon = self.lon - 0.1; + self.lon = self.lon + 0.1; if( -3 < self.lat && self.lat < 3){} else if(self.lat > 10){ self.lat -= 0.1 } @@ -338,9 +340,11 @@ Photosphere.prototype.loadEXIF = function(callback){ xmpEnd = ""; xmpp = data.substring(data.indexOf("3000 getAttr = function(attr){ - x = xmpp.indexOf(attr+'="') + attr.length + 2; - return xmpp.substring( x, xmpp.indexOf('"', x) ); + x = xmpp.indexOf(attr) + attr.length; + s = xmpp.substring( x ); + return s.match(/[0-9]+/)[0]; }; self.exif = {