Fixed graphics bug + updated docs
Fixed issue with getBounds being incorrect for graphics Updated docs Linted code
This commit is contained in:
parent
53506da65e
commit
7713731ab3
145 changed files with 15583 additions and 24078 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
</div>
|
||||
<div class="yui3-u-1-4 version">
|
||||
<em>API Docs for: 1.3.0</em>
|
||||
<em>API Docs for: 1.4.0</em>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bd" class="yui3-g">
|
||||
|
@ -45,6 +45,8 @@
|
|||
|
||||
<li><a href="../classes/AssetLoader.html">AssetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/AtlasLoader.html">AtlasLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
@ -61,7 +63,7 @@
|
|||
|
||||
<li><a href="../classes/ColorMatrixFilter.html">ColorMatrixFilter</a></li>
|
||||
|
||||
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
|
||||
<li><a href="../classes/ColorStepFilter.html">ColorStepFilter</a></li>
|
||||
|
||||
<li><a href="../classes/DisplacementFilter.html">DisplacementFilter</a></li>
|
||||
|
||||
|
@ -75,7 +77,7 @@
|
|||
|
||||
<li><a href="../classes/Graphics.html">Graphics</a></li>
|
||||
|
||||
<li><a href="../classes/GreyFilter.html">GreyFilter</a></li>
|
||||
<li><a href="../classes/GrayFilter.html">GrayFilter</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
|
@ -87,6 +89,8 @@
|
|||
|
||||
<li><a href="../classes/PixelateFilter.html">PixelateFilter</a></li>
|
||||
|
||||
<li><a href="../classes/PIXI.PixiShader.html">PIXI.PixiShader</a></li>
|
||||
|
||||
<li><a href="../classes/Point.html">Point</a></li>
|
||||
|
||||
<li><a href="../classes/Polygon.html">Polygon</a></li>
|
||||
|
@ -109,10 +113,10 @@
|
|||
|
||||
<li><a href="../classes/Spine.html">Spine</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite.html">Sprite</a></li>
|
||||
|
||||
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite™.html">Sprite™</a></li>
|
||||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
@ -121,8 +125,6 @@
|
|||
|
||||
<li><a href="../classes/TilingSprite.html">TilingSprite</a></li>
|
||||
|
||||
<li><a href="../classes/WebGLBatch.html">WebGLBatch</a></li>
|
||||
|
||||
<li><a href="../classes/WebGLRenderer.html">WebGLRenderer</a></li>
|
||||
|
||||
</ul>
|
||||
|
@ -178,29 +180,29 @@
|
|||
* A Class that loads a bunch of images / sprite sheet / bitmap font files. Once the
|
||||
* assets have been loaded they are added to the PIXI Texture cache and can be accessed
|
||||
* easily through PIXI.Texture.fromImage() and PIXI.Sprite.fromImage()
|
||||
* When all items have been loaded this class will dispatch a "onLoaded" event
|
||||
* As each individual item is loaded this class will dispatch a "onProgress" event
|
||||
* When all items have been loaded this class will dispatch a 'onLoaded' event
|
||||
* As each individual item is loaded this class will dispatch a 'onProgress' event
|
||||
*
|
||||
* @class AssetLoader
|
||||
* @constructor
|
||||
* @uses EventTarget
|
||||
* @param {Array<String>} assetURLs an array of image/sprite sheet urls that you would like loaded
|
||||
* supported. Supported image formats include "jpeg", "jpg", "png", "gif". Supported
|
||||
* sprite sheet data formats only include "JSON" at this time. Supported bitmap font
|
||||
* data formats include "xml" and "fnt".
|
||||
* supported. Supported image formats include 'jpeg', 'jpg', 'png', 'gif'. Supported
|
||||
* sprite sheet data formats only include 'JSON' at this time. Supported bitmap font
|
||||
* data formats include 'xml' and 'fnt'.
|
||||
* @param crossorigin {Boolean} Whether requests should be treated as crossorigin
|
||||
*/
|
||||
PIXI.AssetLoader = function(assetURLs, crossorigin)
|
||||
{
|
||||
PIXI.EventTarget.call(this);
|
||||
PIXI.EventTarget.call(this);
|
||||
|
||||
/**
|
||||
* The array of asset URLs that are going to be loaded
|
||||
/**
|
||||
* The array of asset URLs that are going to be loaded
|
||||
*
|
||||
* @property assetURLs
|
||||
* @type Array<String>
|
||||
*/
|
||||
this.assetURLs = assetURLs;
|
||||
* @property assetURLs
|
||||
* @type Array<String>
|
||||
*/
|
||||
this.assetURLs = assetURLs;
|
||||
|
||||
/**
|
||||
* Whether the requests should be treated as cross origin
|
||||
|
@ -208,7 +210,7 @@ PIXI.AssetLoader = function(assetURLs, crossorigin)
|
|||
* @property crossorigin
|
||||
* @type Boolean
|
||||
*/
|
||||
this.crossorigin = crossorigin;
|
||||
this.crossorigin = crossorigin;
|
||||
|
||||
/**
|
||||
* Maps file extension to loader types
|
||||
|
@ -217,17 +219,16 @@ PIXI.AssetLoader = function(assetURLs, crossorigin)
|
|||
* @type Object
|
||||
*/
|
||||
this.loadersByType = {
|
||||
"jpg": PIXI.ImageLoader,
|
||||
"jpeg": PIXI.ImageLoader,
|
||||
"png": PIXI.ImageLoader,
|
||||
"gif": PIXI.ImageLoader,
|
||||
"json": PIXI.JsonLoader,
|
||||
"anim": PIXI.SpineLoader,
|
||||
"xml": PIXI.BitmapFontLoader,
|
||||
"fnt": PIXI.BitmapFontLoader
|
||||
'jpg': PIXI.ImageLoader,
|
||||
'jpeg': PIXI.ImageLoader,
|
||||
'png': PIXI.ImageLoader,
|
||||
'gif': PIXI.ImageLoader,
|
||||
'json': PIXI.JsonLoader,
|
||||
'atlas': PIXI.AtlasLoader,
|
||||
'anim': PIXI.SpineLoader,
|
||||
'xml': PIXI.BitmapFontLoader,
|
||||
'fnt': PIXI.BitmapFontLoader
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -243,6 +244,34 @@ PIXI.AssetLoader = function(assetURLs, crossorigin)
|
|||
// constructor
|
||||
PIXI.AssetLoader.prototype.constructor = PIXI.AssetLoader;
|
||||
|
||||
|
||||
PIXI.AssetLoader.prototype._getDataType = function(str)
|
||||
{
|
||||
var test = 'data:';
|
||||
//starts with 'data:'
|
||||
var start = str.slice(0, test.length).toLowerCase();
|
||||
if (start === test) {
|
||||
var data = str.slice(test.length);
|
||||
|
||||
var sepIdx = data.indexOf(',');
|
||||
if (sepIdx === -1) //malformed data URI scheme
|
||||
return null;
|
||||
|
||||
//e.g. 'image/gif;base64' => 'image/gif'
|
||||
var info = data.slice(0, sepIdx).split(';')[0];
|
||||
|
||||
//We might need to handle some special cases here...
|
||||
//standardize text/plain to 'txt' file extension
|
||||
if (!info || info.toLowerCase() === 'text/plain')
|
||||
return 'txt';
|
||||
|
||||
//User specified mime type, try splitting it by '/'
|
||||
return info.split('/').pop().toLowerCase();
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts loading the assets sequentially
|
||||
*
|
||||
|
@ -252,25 +281,31 @@ PIXI.AssetLoader.prototype.load = function()
|
|||
{
|
||||
var scope = this;
|
||||
|
||||
this.loadCount = this.assetURLs.length;
|
||||
function onLoad() {
|
||||
scope.onAssetLoaded();
|
||||
}
|
||||
|
||||
this.loadCount = this.assetURLs.length;
|
||||
|
||||
for (var i=0; i < this.assetURLs.length; i++)
|
||||
{
|
||||
var fileName = this.assetURLs[i];
|
||||
var fileType = fileName.split(".").pop().toLowerCase();
|
||||
{
|
||||
var fileName = this.assetURLs[i];
|
||||
//first see if we have a data URI scheme..
|
||||
var fileType = this._getDataType(fileName);
|
||||
|
||||
var loaderClass = this.loadersByType[fileType];
|
||||
if(!loaderClass)
|
||||
throw new Error(fileType + " is an unsupported file type");
|
||||
//if not, assume it's a file URI
|
||||
if (!fileType)
|
||||
fileType = fileName.split('?').shift().split('.').pop().toLowerCase();
|
||||
|
||||
var loader = new loaderClass(fileName, this.crossorigin);
|
||||
var Constructor = this.loadersByType[fileType];
|
||||
if(!Constructor)
|
||||
throw new Error(fileType + ' is an unsupported file type');
|
||||
|
||||
loader.addEventListener("loaded", function()
|
||||
{
|
||||
scope.onAssetLoaded();
|
||||
});
|
||||
var loader = new Constructor(fileName, this.crossorigin);
|
||||
|
||||
loader.addEventListener('loaded', onLoad);
|
||||
loader.load();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -282,17 +317,16 @@ PIXI.AssetLoader.prototype.load = function()
|
|||
PIXI.AssetLoader.prototype.onAssetLoaded = function()
|
||||
{
|
||||
this.loadCount--;
|
||||
this.dispatchEvent({type: "onProgress", content: this});
|
||||
if(this.onProgress) this.onProgress();
|
||||
this.dispatchEvent({type: 'onProgress', content: this});
|
||||
if (this.onProgress) this.onProgress();
|
||||
|
||||
if(this.loadCount == 0)
|
||||
{
|
||||
this.dispatchEvent({type: "onComplete", content: this});
|
||||
if(this.onComplete) this.onComplete();
|
||||
}
|
||||
if (!this.loadCount)
|
||||
{
|
||||
this.dispatchEvent({type: 'onComplete', content: this});
|
||||
if(this.onComplete) this.onComplete();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue