Skip to content

Commit f7150c2

Browse files
committed
Switch deprecated interface to new supported one
1 parent e282432 commit f7150c2

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/events/acceleration.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,7 @@ function acceleration(p5, fn, lifecycles){
463463
* </code>
464464
* </div>
465465
*/
466-
467466
fn.setMoveThreshold = function (val) {
468-
// p5._validateParameters('setMoveThreshold', arguments);
469467
move_threshold = val;
470468
};
471469

@@ -505,9 +503,7 @@ function acceleration(p5, fn, lifecycles){
505503
* </code>
506504
* </div>
507505
*/
508-
509506
fn.setShakeThreshold = function (val) {
510-
// p5._validateParameters('setShakeThreshold', arguments);
511507
shake_threshold = val;
512508
};
513509

@@ -647,11 +643,17 @@ function acceleration(p5, fn, lifecycles){
647643
};
648644

649645
fn._handleMotion = function () {
650-
if (window.orientation === 90 || window.orientation === -90) {
646+
if (
647+
screen.orientation.type === 'landscape-primary' ||
648+
screen.orientation.type === 'landscape-secondary'
649+
) {
651650
this.deviceOrientation = 'landscape';
652-
} else if (window.orientation === 0) {
651+
} else if (
652+
screen.orientation.type === 'portrait-primary' ||
653+
screen.orientation.type === 'portrait-secondary'
654+
) {
653655
this.deviceOrientation = 'portrait';
654-
} else if (window.orientation === undefined) {
656+
} else {
655657
this.deviceOrientation = 'undefined';
656658
}
657659

0 commit comments

Comments
 (0)