Skip to content

Commit

Permalink
Merge pull request #11 from dorukeker/FullTilt_upgrade
Browse files Browse the repository at this point in the history
Full tilt upgrade
  • Loading branch information
dorukeker committed Aug 11, 2015
2 parents f2df4d9 + 7da04ea commit 1d6e17d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"license": "MIT",
"devDependencies": {
"bootstrap": "~3.3.2",
"fulltilt": "0.5.2",
"fulltilt": "0.7",
"es6-promise": "*"
}
}
4 changes: 4 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@
}

start_gn();
}).catch(function(e){

console.log(e);

});
}

Expand Down
21 changes: 13 additions & 8 deletions lib/gyronorm.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,29 +231,34 @@
*/
GyroNorm.prototype.isAvailable = function(_eventType) {

var doSnapShot = _do.getScreenAdjustedEuler();
var accSnapShot = _dm.getScreenAdjustedAcceleration();
var accGraSnapShot = _dm.getScreenAdjustedAccelerationIncludingGravity();
var rotRateSnapShot = _dm.getScreenAdjustedRotationRate();

switch (_eventType) {
case DEVICE_ORIENTATION:
return (_do.isAvailable(_do.ALPHA) && _do.isAvailable(_do.BETA) && _do.isAvailable(_do.GAMMA));
return ((doSnapShot.alpha && doSnapShot.alpha !== null) && (doSnapShot.beta && doSnapShot.beta !== null) && (doSnapShot.gamma && doSnapShot.gamma !== null));
break;

case ACCELERATION:
return (_dm.isAvailable(_dm.ACCELERATION_X) && _dm.isAvailable(_dm.ACCELERATION_Y) && _dm.isAvailable(_dm.ACCELERATION_Z));
return (accSnapShot && accSnapShot.x && accSnapShot.y && accSnapShot.z);
break;

case ACCELERATION_INCLUDING_GRAVITY:
return (_dm.isAvailable(_dm.ACCELERATION_INCLUDING_GRAVITY_X) && _dm.isAvailable(_dm.ACCELERATION_INCLUDING_GRAVITY_Y) && _dm.isAvailable(_dm.ACCELERATION_INCLUDING_GRAVITY_Z));
return (accGraSnapShot && accGraSnapShot.x && accGraSnapShot.y && accGraSnapShot.z);
break;

case ROTATION_RATE:
return (_dm.isAvailable(_dm.ROTATION_RATE_ALPHA) && _dm.isAvailable(_dm.ROTATION_RATE_BETA) && _dm.isAvailable(_dm.ROTATION_RATE_GAMMA));
return (rotRateSnapShot && rotRateSnapShot.alpha && rotRateSnapShot.beta && rotRateSnapShot.gamma);
break;

default:
return {
deviceOrientationAvailable: (_do.isAvailable(_do.ALPHA) && _do.isAvailable(_do.BETA) && _do.isAvailable(_do.GAMMA)),
accelerationAvailable: (_dm.isAvailable(_dm.ACCELERATION_X) && _dm.isAvailable(_dm.ACCELERATION_Y) && _dm.isAvailable(_dm.ACCELERATION_Z)),
accelerationIncludingGravityAvailable: (_dm.isAvailable(_dm.ACCELERATION_INCLUDING_GRAVITY_X) && _dm.isAvailable(_dm.ACCELERATION_INCLUDING_GRAVITY_Y) && _dm.isAvailable(_dm.ACCELERATION_INCLUDING_GRAVITY_Z)),
rotationRateAvailable: (_dm.isAvailable(_dm.ROTATION_RATE_ALPHA) && _dm.isAvailable(_dm.ROTATION_RATE_BETA) && _dm.isAvailable(_dm.ROTATION_RATE_GAMMA))
deviceOrientationAvailable: ((doSnapShot.alpha && doSnapShot.alpha !== null) && (doSnapShot.beta && doSnapShot.beta !== null) && (doSnapShot.gamma && doSnapShot.gamma !== null)),
accelerationAvailable: (accSnapShot && accSnapShot.x && accSnapShot.y && accSnapShot.z),
accelerationIncludingGravityAvailable: (accGraSnapShot && accGraSnapShot.x && accGraSnapShot.y && accGraSnapShot.z),
rotationRateAvailable: (rotRateSnapShot && rotRateSnapShot.alpha && rotRateSnapShot.beta && rotRateSnapShot.gamma)
}
break;
}
Expand Down

0 comments on commit 1d6e17d

Please sign in to comment.