mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix ipad
This commit is contained in:
parent
06e44f90b4
commit
1fc7db6087
1 changed files with 25 additions and 5 deletions
30
src/Util.hx
30
src/Util.hx
|
|
@ -436,8 +436,18 @@ class Util {
|
||||||
|
|
||||||
public static inline function isIOS() {
|
public static inline function isIOS() {
|
||||||
#if js
|
#if js
|
||||||
var reg = ~/iPad|iPhone|iPod/;
|
var reg = ~/iPad|iPhone|iPod/gm;
|
||||||
return reg.match(js.Browser.navigator.userAgent);
|
var t1 = reg.match(js.Browser.navigator.userAgent);
|
||||||
|
if (!t1) {
|
||||||
|
var reg2 = ~/Mac/gm;
|
||||||
|
if (reg2.match(js.Browser.navigator.userAgent)
|
||||||
|
&& js.Browser.navigator.maxTouchPoints != null
|
||||||
|
&& js.Browser.navigator.maxTouchPoints > 2) {
|
||||||
|
return true; // Is ipad pro
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
#end
|
#end
|
||||||
#if hl
|
#if hl
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -446,8 +456,18 @@ class Util {
|
||||||
|
|
||||||
public static inline function isTablet() {
|
public static inline function isTablet() {
|
||||||
#if js
|
#if js
|
||||||
var reg = ~/iPad|tablet/;
|
var reg = ~/iPad|tablet/gm;
|
||||||
return reg.match(js.Browser.navigator.userAgent);
|
var t1 = reg.match(js.Browser.navigator.userAgent);
|
||||||
|
if (!t1) {
|
||||||
|
var reg2 = ~/Mac/gm;
|
||||||
|
if (reg2.match(js.Browser.navigator.userAgent)
|
||||||
|
&& js.Browser.navigator.maxTouchPoints != null
|
||||||
|
&& js.Browser.navigator.maxTouchPoints > 2) {
|
||||||
|
return true; // Is ipad pro
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
#end
|
#end
|
||||||
#if hl
|
#if hl
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -456,7 +476,7 @@ class Util {
|
||||||
|
|
||||||
public static inline function isIPhone() {
|
public static inline function isIPhone() {
|
||||||
#if js
|
#if js
|
||||||
var reg = ~/iPhone/;
|
var reg = ~/iPhone/gm;
|
||||||
return reg.match(js.Browser.navigator.userAgent);
|
return reg.match(js.Browser.navigator.userAgent);
|
||||||
#end
|
#end
|
||||||
#if hl
|
#if hl
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue