diff --git a/src/core/const.js b/src/core/const.js index 8b75932..8f98ee0 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -101,7 +101,8 @@ * @constant * @property {string} RETINA_PREFIX */ - RETINA_PREFIX: '@2x', + //example: '@2x', + RETINA_PREFIX: /@(.+)x/, RESOLUTION:1, diff --git a/src/core/const.js b/src/core/const.js index 8b75932..8f98ee0 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -101,7 +101,8 @@ * @constant * @property {string} RETINA_PREFIX */ - RETINA_PREFIX: '@2x', + //example: '@2x', + RETINA_PREFIX: /@(.+)x/, RESOLUTION:1, diff --git a/src/core/utils/index.js b/src/core/utils/index.js index 222cb87..da6c73d 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -144,14 +144,14 @@ */ getResolutionOfUrl: function (url) { - if ( url.indexOf(CONST.RETINA_PREFIX + '.') !== -1) + var resolution = PIXI.RETINA_PREFIX.exec(url); + + if (resolution) { - return 2; + return parseFloat(resolution[1]); } - else - { - return 1; - } + + return 1; }, /**