@pixi/utils
Version:
Collection of utilities used by PixiJS
1 lines • 938 B
Source Map (JSON)
{"version":3,"file":"getResolutionOfUrl.mjs","sources":["../../src/network/getResolutionOfUrl.ts"],"sourcesContent":["import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue = 1): number\n{\n const resolution = settings.RETINA_PREFIX?.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue;\n}\n"],"names":[],"mappings":";;AAWgB,SAAA,mBAAmB,KAAa,eAAe,GAC/D;AACI,QAAM,aAAa,SAAS,eAAe,KAAK,GAAG;AAEnD,SAAI,aAEO,WAAW,WAAW,CAAC,CAAC,IAG5B;AACX;"}