UNPKG

851 BJavaScriptView Raw
1import { settings, isMobile } from '@pixi/settings';
2
3function maxRecommendedTextures(max) {
4 let allowMax = true;
5 const navigator = settings.ADAPTER.getNavigator();
6 if (isMobile.tablet || isMobile.phone) {
7 if (isMobile.apple.device) {
8 const match = navigator.userAgent.match(/OS (\d+)_(\d+)?/);
9 if (match) {
10 const majorVersion = parseInt(match[1], 10);
11 if (majorVersion < 11) {
12 allowMax = false;
13 }
14 }
15 }
16 if (isMobile.android.device) {
17 const match = navigator.userAgent.match(/Android\s([0-9.]*)/);
18 if (match) {
19 const majorVersion = parseInt(match[1], 10);
20 if (majorVersion < 7) {
21 allowMax = false;
22 }
23 }
24 }
25 }
26 return allowMax ? max : 4;
27}
28
29export { maxRecommendedTextures };
30//# sourceMappingURL=maxRecommendedTextures.mjs.map