@@ -1127,6 +1127,10 @@ FULLTILT.getDeviceOrientation = function(options) {
11271127
11281128 orientationSensorCheck . then ( function ( ) {
11291129
1130+ control . _alphaAvailable = ( sensors . orientation . data . alpha && sensors . orientation . data . alpha !== null ) ;
1131+ control . _betaAvailable = ( sensors . orientation . data . beta && sensors . orientation . data . beta !== null ) ;
1132+ control . _gammaAvailable = ( sensors . orientation . data . gamma && sensors . orientation . data . gamma !== null ) ;
1133+
11301134 resolve ( control ) ;
11311135
11321136 } ) . catch ( function ( ) {
@@ -1154,6 +1158,18 @@ FULLTILT.getDeviceMotion = function(options) {
11541158
11551159 motionSensorCheck . then ( function ( ) {
11561160
1161+ control . _accelerationXAvailable = ( sensors . motion . data . acceleration && sensors . motion . data . acceleration . x ) ;
1162+ control . _accelerationYAvailable = ( sensors . motion . data . acceleration && sensors . motion . data . acceleration . y ) ;
1163+ control . _accelerationZAvailable = ( sensors . motion . data . acceleration && sensors . motion . data . acceleration . z ) ;
1164+
1165+ control . _accelerationIncludingGravityXAvailable = ( sensors . motion . data . accelerationIncludingGravity && sensors . motion . data . accelerationIncludingGravity . x ) ;
1166+ control . _accelerationIncludingGravityYAvailable = ( sensors . motion . data . accelerationIncludingGravity && sensors . motion . data . accelerationIncludingGravity . y ) ;
1167+ control . _accelerationIncludingGravityZAvailable = ( sensors . motion . data . accelerationIncludingGravity && sensors . motion . data . accelerationIncludingGravity . z ) ;
1168+
1169+ control . _rotationRateAlphaAvailable = ( sensors . motion . data . rotationRate && sensors . motion . data . rotationRate . alpha ) ;
1170+ control . _rotationRateBetaAvailable = ( sensors . motion . data . rotationRate && sensors . motion . data . rotationRate . beta ) ;
1171+ control . _rotationRateGammaAvailable = ( sensors . motion . data . rotationRate && sensors . motion . data . rotationRate . gamma ) ;
1172+
11571173 resolve ( control ) ;
11581174
11591175 } ) . catch ( function ( ) {
@@ -2172,6 +2188,25 @@ FULLTILT.DeviceOrientation.prototype = {
21722188
21732189 } ,
21742190
2191+ _alphaAvailable : false ,
2192+ _betaAvailable : false ,
2193+ _gammaAvailable : false ,
2194+
2195+ isAvailable : function ( _valueType ) {
2196+
2197+ switch ( _valueType ) {
2198+ case this . ALPHA :
2199+ return this . _alphaAvailable ;
2200+
2201+ case this . BETA :
2202+ return this . _betaAvailable ;
2203+
2204+ case this . GAMMA :
2205+ return this . _gammaAvailable ;
2206+ }
2207+
2208+ } ,
2209+
21752210 ALPHA : 'alpha' ,
21762211 BETA : 'beta' ,
21772212 GAMMA : 'gamma'
@@ -2338,10 +2373,65 @@ FULLTILT.DeviceMotion.prototype = {
23382373
23392374 return sensors . motion . data || { } ;
23402375
2341- }
2376+ } ,
23422377
2343- } ;
2378+ _accelerationXAvailable : false ,
2379+ _accelerationYAvailable : false ,
2380+ _accelerationZAvailable : false ,
2381+
2382+ _accelerationIncludingGravityXAvailable : false ,
2383+ _accelerationIncludingGravityYAvailable : false ,
2384+ _accelerationIncludingGravityZAvailable : false ,
2385+
2386+ _rotationRateAlphaAvailable : false ,
2387+ _rotationRateBetaAvailable : false ,
2388+ _rotationRateGammaAvailable : false ,
23442389
2390+ isAvailable : function ( _valueType ) {
2391+
2392+ switch ( _valueType ) {
2393+ case this . ACCELERATION_X :
2394+ return this . _accelerationXAvailable ;
2395+
2396+ case this . ACCELERATION_Y :
2397+ return this . _accelerationYAvailable ;
2398+
2399+ case this . ACCELERATION_Z :
2400+ return this . _accelerationZAvailable ;
2401+
2402+ case this . ACCELERATION_INCLUDING_GRAVITY_X :
2403+ return this . _accelerationIncludingGravityXAvailable ;
2404+
2405+ case this . ACCELERATION_INCLUDING_GRAVITY_Y :
2406+ return this . _accelerationIncludingGravityYAvailable ;
2407+
2408+ case this . ACCELERATION_INCLUDING_GRAVITY_Z :
2409+ return this . _accelerationIncludingGravityZAvailable ;
2410+
2411+ case this . ROTATION_RATE_ALPHA :
2412+ return this . _rotationRateAlphaAvailable ;
2413+
2414+ case this . ROTATION_RATE_BETA :
2415+ return this . _rotationRateBetaAvailable ;
2416+
2417+ case this . ROTATION_RATE_GAMMA :
2418+ return this . _rotationRateGammaAvailable ;
2419+ }
2420+ } ,
2421+
2422+ ACCELERATION_X : 'accelerationX' ,
2423+ ACCELERATION_Y : 'accelerationY' ,
2424+ ACCELERATION_Z : 'accelerationZ' ,
2425+
2426+ ACCELERATION_INCLUDING_GRAVITY_X : 'accelerationIncludingGravityX' ,
2427+ ACCELERATION_INCLUDING_GRAVITY_Y : 'accelerationIncludingGravityY' ,
2428+ ACCELERATION_INCLUDING_GRAVITY_Z : 'accelerationIncludingGravityZ' ,
2429+
2430+ ROTATION_RATE_ALPHA : 'rotationRateAlpha' ,
2431+ ROTATION_RATE_BETA : 'rotationRateBeta' ,
2432+ ROTATION_RATE_GAMMA : 'rotationRateGamma'
2433+
2434+ } ;
23452435
23462436////// Attach FULLTILT to root DOM element //////
23472437
@@ -2352,7 +2442,7 @@ window.FULLTILT = FULLTILT;
23522442*
23532443* @author Doruk Eker <dorukeker@gmail.com>
23542444* @copyright Doruk Eker <http://dorukeker.com>
2355- * @version 2.0.3
2445+ * @version 2.0.4
23562446* @license MIT License | http://opensource.org/licenses/MIT
23572447*/
23582448
0 commit comments