Fixed graphics bug + updated docs

Fixed issue with getBounds being incorrect for graphics
Updated docs
Linted code
This commit is contained in:
Mat Groves 2014-01-01 23:54:45 +00:00
parent 53506da65e
commit 7713731ab3
145 changed files with 15583 additions and 24078 deletions

View file

@ -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>
@ -175,7 +177,7 @@
*/
/**
* A Text Object will create a line(s) of text using bitmap font. To split a line you can use &quot;\n&quot;, &quot;\r&quot; or &quot;\r\n&quot;
* A Text Object will create a line(s) of text using bitmap font. To split a line you can use &#x27;\n&#x27;, &#x27;\r&#x27; or &#x27;\r\n&#x27;
* You can generate the fnt files using
* http://www.angelcode.com/products/bmfont/ for windows or
* http://www.bmglyph.com/ for mac.
@ -185,8 +187,8 @@
* @constructor
* @param text {String} The copy that you would like the text to display
* @param style {Object} The style parameters
* @param style.font {String} The size (optional) and bitmap font id (required) eq &quot;Arial&quot; or &quot;20px Arial&quot; (must have loaded previously)
* @param [style.align=&quot;left&quot;] {String} An alignment of the multiline text (&quot;left&quot;, &quot;center&quot; or &quot;right&quot;)
* @param style.font {String} The size (optional) and bitmap font id (required) eq &#x27;Arial&#x27; or &#x27;20px Arial&#x27; (must have loaded previously)
* @param [style.align=&#x27;left&#x27;] {String} An alignment of the multiline text (&#x27;left&#x27;, &#x27;center&#x27; or &#x27;right&#x27;)
*/
PIXI.BitmapText = function(text, style)
{
@ -195,8 +197,7 @@ PIXI.BitmapText = function(text, style)
this.setText(text);
this.setStyle(style);
this.updateText();
this.dirty = false
this.dirty = false;
};
// constructor
@ -211,7 +212,7 @@ PIXI.BitmapText.prototype.constructor = PIXI.BitmapText;
*/
PIXI.BitmapText.prototype.setText = function(text)
{
this.text = text || &quot; &quot;;
this.text = text || &#x27; &#x27;;
this.dirty = true;
};
@ -220,16 +221,16 @@ PIXI.BitmapText.prototype.setText = function(text)
*
* @method setStyle
* @param style {Object} The style parameters
* @param style.font {String} The size (optional) and bitmap font id (required) eq &quot;Arial&quot; or &quot;20px Arial&quot; (must have loaded previously)
* @param [style.align=&quot;left&quot;] {String} An alignment of the multiline text (&quot;left&quot;, &quot;center&quot; or &quot;right&quot;)
* @param style.font {String} The size (optional) and bitmap font id (required) eq &#x27;Arial&#x27; or &#x27;20px Arial&#x27; (must have loaded previously)
* @param [style.align=&#x27;left&#x27;] {String} An alignment of the multiline text (&#x27;left&#x27;, &#x27;center&#x27; or &#x27;right&#x27;)
*/
PIXI.BitmapText.prototype.setStyle = function(style)
{
style = style || {};
style.align = style.align || &quot;left&quot;;
style.align = style.align || &#x27;left&#x27;;
this.style = style;
var font = style.font.split(&quot; &quot;);
var font = style.font.split(&#x27; &#x27;);
this.fontName = font[font.length - 1];
this.fontSize = font.length &gt;= 2 ? parseInt(font[font.length - 2], 10) : PIXI.BitmapText.fonts[this.fontName].size;
@ -272,7 +273,7 @@ PIXI.BitmapText.prototype.updateText = function()
if(prevCharCode &amp;&amp; charData[prevCharCode])
{
pos.x += charData.kerning[prevCharCode];
pos.x += charData.kerning[prevCharCode];
}
chars.push({texture:charData.texture, line: line, charCode: charCode, position: new PIXI.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)});
pos.x += charData.xAdvance;
@ -287,11 +288,11 @@ PIXI.BitmapText.prototype.updateText = function()
for(i = 0; i &lt;= line; i++)
{
var alignOffset = 0;
if(this.style.align == &quot;right&quot;)
if(this.style.align === &#x27;right&#x27;)
{
alignOffset = maxLineWidth - lineWidths[i];
}
else if(this.style.align == &quot;center&quot;)
else if(this.style.align === &#x27;center&#x27;)
{
alignOffset = (maxLineWidth - lineWidths[i]) / 2;
}
@ -300,14 +301,14 @@ PIXI.BitmapText.prototype.updateText = function()
for(i = 0; i &lt; chars.length; i++)
{
var c = new PIXI.Sprite(chars[i].texture)//PIXI.Sprite.fromFrame(chars[i].charCode);
var c = new PIXI.Sprite(chars[i].texture); //PIXI.Sprite.fromFrame(chars[i].charCode);
c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale;
c.position.y = chars[i].position.y * scale;
c.scale.x = c.scale.y = scale;
this.addChild(c);
}
this.width = pos.x * scale;
this.width = maxLineWidth * scale;
this.height = (pos.y + data.lineHeight) * scale;
};
@ -319,8 +320,8 @@ PIXI.BitmapText.prototype.updateText = function()
*/
PIXI.BitmapText.prototype.updateTransform = function()
{
if(this.dirty)
{
if(this.dirty)
{
while(this.children.length &gt; 0)
{
this.removeChild(this.getChildAt(0));
@ -328,9 +329,9 @@ PIXI.BitmapText.prototype.updateTransform = function()
this.updateText();
this.dirty = false;
}
}
PIXI.DisplayObjectContainer.prototype.updateTransform.call(this);
PIXI.DisplayObjectContainer.prototype.updateTransform.call(this);
};
PIXI.BitmapText.fonts = {};