Skip to content

Commit af70675

Browse files
committed
Support navigator on iPad
1 parent dd5ce23 commit af70675

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

aframe/src/new-location-based/gps-new-camera.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@ AFRAME.registerComponent("gps-new-camera", {
203203
if (
204204
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
205205
navigator.userAgent,
206-
)
206+
) ||
207+
(/Macintosh/i.test(navigator.userAgent) &&
208+
navigator.maxTouchPoints != null &&
209+
navigator.maxTouchPoints > 1) // for iPad Safari
207210
) {
208211
// true for mobile device
209212
return true;

three.js/examples/location-based/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ function main() {
9292
}
9393

9494
function isMobile() {
95-
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
95+
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||
96+
(/Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints != null && navigator.maxTouchPoints > 1) // for iPad Safari
97+
) {
9698
// true for mobile device
9799
return true;
98100
}

three.js/examples/vendor/webvr-polyfill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5431,7 +5431,7 @@ Util.lerp = function(a, b, t) {
54315431
};
54325432

54335433
Util.isIOS = (function() {
5434-
var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);
5434+
var isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || (/MacIntel/.test(navigator.platform) && navigator.maxTouchPoints != null && navigator.maxTouchPoints > 1);
54355435
return function() {
54365436
return isIOS;
54375437
};

three.js/src/threex/arjs-profile.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Profile.prototype._guessPerformanceLabel = function () {
2020
navigator.userAgent.match(/webOS/i) ||
2121
navigator.userAgent.match(/iPhone/i) ||
2222
navigator.userAgent.match(/iPad/i) ||
23+
(navigator.userAgent.match(/Macintosh/i) &&
24+
navigator.maxTouchPoints != null &&
25+
navigator.maxTouchPoints > 1) || // for iPad Safari
2326
navigator.userAgent.match(/iPod/i) ||
2427
navigator.userAgent.match(/BlackBerry/i) ||
2528
navigator.userAgent.match(/Windows Phone/i)

0 commit comments

Comments
 (0)