photo-sphere-viewer
Advanced tools
Comparing version 3.5.0 to 3.5.1
{ | ||
"name": "photo-sphere-viewer", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ { |
@@ -753,3 +753,5 @@ /** | ||
PhotoSphereViewer.prototype.exitFullscreen = function() { | ||
PSVUtils.exitFullscreen(); | ||
if (this.isFullscreenEnabled()) { | ||
PSVUtils.exitFullscreen(); | ||
} | ||
}; | ||
@@ -756,0 +758,0 @@ |
@@ -175,5 +175,5 @@ /** | ||
PhotoSphereViewer.prototype.cleanSphereCorrection = function(sphere_correction) { | ||
sphere_correction.pan = PSVUtils.parseAngle(sphere_correction.pan || 0, true); | ||
sphere_correction.pan = PSVUtils.parseAngle(sphere_correction.pan || 0); | ||
sphere_correction.tilt = PSVUtils.parseAngle(sphere_correction.tilt || 0, true); | ||
sphere_correction.roll = PSVUtils.parseAngle(sphere_correction.roll || 0, true); | ||
sphere_correction.roll = PSVUtils.parseAngle(sphere_correction.roll || 0, true, false); | ||
}; | ||
@@ -180,0 +180,0 @@ |
@@ -589,6 +589,11 @@ /** | ||
* @param {boolean} [zeroCenter=false] - normalize between -Pi/2 - Pi/2 instead of 0 - 2*Pi | ||
* @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi - Pi instead of -Pi/2 - Pi/2 | ||
* @returns {float} | ||
* @throws {PSVError} when the angle cannot be parsed | ||
*/ | ||
PSVUtils.parseAngle = function(angle, zeroCenter) { | ||
PSVUtils.parseAngle = function(angle, zeroCenter, halfCircle) { | ||
if (halfCircle === undefined) { | ||
halfCircle = zeroCenter; | ||
} | ||
if (typeof angle === 'string') { | ||
@@ -629,3 +634,3 @@ var match = angle.toLowerCase().trim().match(/^(-?[0-9]+(?:\.[0-9]*)?)(.*)$/); | ||
return zeroCenter ? PSVUtils.bound(angle - Math.PI, -PSVUtils.HalfPI, PSVUtils.HalfPI) : angle; | ||
return zeroCenter ? PSVUtils.bound(angle - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : angle; | ||
}; | ||
@@ -632,0 +637,0 @@ |
@@ -66,2 +66,13 @@ var vm = require('vm'); | ||
it('should normalize angles between -Pi and Pi', function() { | ||
var values = { | ||
'45deg': Math.PI / 4, | ||
'4': -2 * Math.PI + 4 | ||
}; | ||
for (var pos in values) { | ||
assert.equal(PSVUtils.parseAngle(pos, true, false).toFixed(16), values[pos].toFixed(16), pos); | ||
} | ||
}); | ||
it('should throw exception on invalid values', function() { | ||
@@ -68,0 +79,0 @@ assert.throws(function() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
601490
14372