@pixi/core
Version:
Core PixiJS
31 lines (28 loc) • 851 B
JavaScript
import { settings, isMobile } from '@pixi/settings';
function maxRecommendedTextures(max) {
let allowMax = true;
const navigator = settings.ADAPTER.getNavigator();
if (isMobile.tablet || isMobile.phone) {
if (isMobile.apple.device) {
const match = navigator.userAgent.match(/OS (\d+)_(\d+)?/);
if (match) {
const majorVersion = parseInt(match[1], 10);
if (majorVersion < 11) {
allowMax = false;
}
}
}
if (isMobile.android.device) {
const match = navigator.userAgent.match(/Android\s([0-9.]*)/);
if (match) {
const majorVersion = parseInt(match[1], 10);
if (majorVersion < 7) {
allowMax = false;
}
}
}
}
return allowMax ? max : 4;
}
export { maxRecommendedTextures };
//# sourceMappingURL=maxRecommendedTextures.mjs.map