Docs updated

This commit is contained in:
Mat Groves 2013-11-02 11:37:42 +00:00
parent a46b74f8ca
commit 6c762fb396
119 changed files with 38715 additions and 9039 deletions

View file

@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;pixi&#x2F;display&#x2F;DisplayObjectContainer.js - Pixi.JS</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.8.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.8.0&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
<title>src/pixi/display/DisplayObjectContainer.js - Pixi.JS</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
@ -15,7 +15,7 @@
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http:&#x2F;&#x2F;www.goodboydigital.com&#x2F;pixijs&#x2F;logo_small.png" title="Pixi.JS"></h1>
<h1><img src="http://www.goodboydigital.com/pixijs/logo_small.png" title="Pixi.JS"></h1>
</div>
<div class="yui3-u-1-4 version">
@ -41,71 +41,95 @@
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="../classes/AbstractFilter.html">AbstractFilter</a></li>
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="../classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/CanvasGraphics.html">CanvasGraphics</a></li>
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="../classes/BlurFilter.html">BlurFilter</a></li>
<li><a href="..&#x2F;classes/Circle.html">Circle</a></li>
<li><a href="../classes/CanvasGraphics.html">CanvasGraphics</a></li>
<li><a href="..&#x2F;classes/CustomRenderable.html">CustomRenderable</a></li>
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="../classes/Circle.html">Circle</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="../classes/ColorMatrixFilter.html">ColorMatrixFilter</a></li>
<li><a href="..&#x2F;classes/Ellipse.html">Ellipse</a></li>
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
<li><a href="..&#x2F;classes/Graphics.html">Graphics</a></li>
<li><a href="../classes/DisplacementFilter.html">DisplacementFilter</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
<li><a href="../classes/Ellipse.html">Ellipse</a></li>
<li><a href="..&#x2F;classes/JsonLoader.html">JsonLoader</a></li>
<li><a href="../classes/EventTarget.html">EventTarget</a></li>
<li><a href="..&#x2F;classes/MovieClip.html">MovieClip</a></li>
<li><a href="../classes/Graphics.html">Graphics</a></li>
<li><a href="..&#x2F;classes/Point.html">Point</a></li>
<li><a href="../classes/GreyFilter.html">GreyFilter</a></li>
<li><a href="..&#x2F;classes/Polygon.html">Polygon</a></li>
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/Rectangle.html">Rectangle</a></li>
<li><a href="../classes/InvertFilter.html">InvertFilter</a></li>
<li><a href="..&#x2F;classes/RenderTexture.html">RenderTexture</a></li>
<li><a href="../classes/JsonLoader.html">JsonLoader</a></li>
<li><a href="..&#x2F;classes/Spine.html">Spine</a></li>
<li><a href="../classes/MovieClip.html">MovieClip</a></li>
<li><a href="..&#x2F;classes/Sprite.html">Sprite</a></li>
<li><a href="../classes/PixelateFilter.html">PixelateFilter</a></li>
<li><a href="..&#x2F;classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="../classes/Point.html">Point</a></li>
<li><a href="..&#x2F;classes/Stage.html">Stage</a></li>
<li><a href="../classes/Polygon.html">Polygon</a></li>
<li><a href="..&#x2F;classes/Text.html">Text</a></li>
<li><a href="../classes/PolyK._convex.html">PolyK._convex</a></li>
<li><a href="..&#x2F;classes/Texture.html">Texture</a></li>
<li><a href="../classes/PolyK._PointInTriangle.html">PolyK._PointInTriangle</a></li>
<li><a href="..&#x2F;classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="../classes/PolyK.AjaxRequest.html">PolyK.AjaxRequest</a></li>
<li><a href="..&#x2F;classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="../classes/PolyK.InteractionData.html">PolyK.InteractionData</a></li>
<li><a href="..&#x2F;classes/WebGLRenderer.html">WebGLRenderer</a></li>
<li><a href="../classes/PolyK.InteractionManager.html">PolyK.InteractionManager</a></li>
<li><a href="../classes/Rectangle.html">Rectangle</a></li>
<li><a href="../classes/RenderTexture.html">RenderTexture</a></li>
<li><a href="../classes/SepiaFilter.html">SepiaFilter</a></li>
<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/Stage.html">Stage</a></li>
<li><a href="../classes/Text.html">Text</a></li>
<li><a href="../classes/Texture.html">Texture</a></li>
<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>
<ul id="api-modules" class="apis modules">
<li><a href="..&#x2F;modules/PIXI.html">PIXI</a></li>
<li><a href="../modules/PIXI.html">PIXI</a></li>
</ul>
</div>
@ -142,76 +166,62 @@
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;display&#x2F;DisplayObjectContainer.js</h1>
<h1 class="file-heading">File: src/pixi/display/DisplayObjectContainer.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;**
* @author Mat Groves http:&#x2F;&#x2F;matgroves.com&#x2F; @Doormat23
*&#x2F;
/**
* @author Mat Groves http://matgroves.com/ @Doormat23
*/
&#x2F;**
* A DisplayObjectContainer represents a collection of display objects. It is the base class of all display objects that act as a container for other objects.
/**
* A DisplayObjectContainer represents a collection of display objects.
* It is the base class of all display objects that act as a container for other objects.
*
* @class DisplayObjectContainer
* @extends DisplayObject
* @constructor
*&#x2F;
*/
PIXI.DisplayObjectContainer = function()
{
PIXI.DisplayObject.call( this );
&#x2F;**
/**
* [read-only] The of children of this container.
* @property children {Array}
*&#x2F;
*
* @property children
* @type Array&lt;DisplayObject&gt;
* @readOnly
*/
this.children = [];
&#x2F;&#x2F;s
this.renderable = false;
}
&#x2F;&#x2F; constructor
PIXI.DisplayObjectContainer.constructor = PIXI.DisplayObjectContainer;
// constructor
PIXI.DisplayObjectContainer.prototype = Object.create( PIXI.DisplayObject.prototype );
PIXI.DisplayObjectContainer.prototype.constructor = PIXI.DisplayObjectContainer;
&#x2F;&#x2F;TODO make visible a getter setter
&#x2F;*
Object.defineProperty(PIXI.DisplayObjectContainer.prototype, &#x27;visible&#x27;, {
get: function() {
return this._visible;
},
set: function(value) {
this._visible = value;
}
});*&#x2F;
&#x2F;**
/**
* Adds a child to the container.
*
* @method addChild
* @param DisplayObject {DisplayObject}
*&#x2F;
* @param child {DisplayObject} The DisplayObject to add to the container
*/
PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{
&#x2F;&#x2F;this.addChildAt(child, this.children.length)
&#x2F;&#x2F;return;
if(child.parent != undefined)
{
&#x2F;&#x2F;&#x2F;&#x2F; COULD BE THIS???
//// COULD BE THIS???
child.parent.removeChild(child);
&#x2F;&#x2F; return;
// return;
}
child.parent = this;
&#x2F;&#x2F;child.childIndex = this.children.length;
this.children.push(child);
&#x2F;&#x2F; updae the stage refference..
// update the stage refference..
if(this.stage)
{
@ -225,17 +235,16 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
while(tmpChild)
}
&#x2F;&#x2F; LINKED LIST &#x2F;&#x2F;
// LINKED LIST //
&#x2F;&#x2F; modify the list..
// modify the list..
var childFirst = child.first
var childLast = child.last;
&#x2F;&#x2F; console.log(childFirst)
var nextObject;
var previousObject;
&#x2F;&#x2F; this could be wrong if there is a filter??
if(this.filter)
// this could be wrong if there is a filter??
if(this._filters || this._mask)
{
previousObject = this.last._iPrev;
}
@ -243,14 +252,11 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{
previousObject = this.last;
}
&#x2F;&#x2F; if(this.last._iNext)
&#x2F;&#x2F;console.log( this.last._iNext);
nextObject = previousObject._iNext;
&#x2F;&#x2F; always true in this case
&#x2F;&#x2F;this.last = child.last;
&#x2F;&#x2F; need to make sure the parents last is updated too
// always true in this case
// need to make sure the parents last is updated too
var updateLast = this;
var prevLast = previousObject;
@ -271,25 +277,25 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
childFirst._iPrev = previousObject;
previousObject._iNext = childFirst;
&#x2F;&#x2F; console.log(childFirst);
&#x2F;&#x2F; need to remove any render groups..
// need to remove any render groups..
if(this.__renderGroup)
{
&#x2F;&#x2F; being used by a renderTexture.. if it exists then it must be from a render texture;
// being used by a renderTexture.. if it exists then it must be from a render texture;
if(child.__renderGroup)child.__renderGroup.removeDisplayObjectAndChildren(child);
&#x2F;&#x2F; add them to the new render group..
// add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child);
}
}
&#x2F;**
/**
* Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown
*
* @method addChildAt
* @param DisplayObject {DisplayObject}
* @param index {Number}
*&#x2F;
* @param child {DisplayObject} The child to add
* @param index {Number} The index to place the child in
*/
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{
if(index &gt;= 0 &amp;&amp; index &lt;= this.children.length)
@ -312,8 +318,8 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
while(tmpChild)
}
&#x2F;&#x2F; modify the list..
var childFirst = child.first
// modify the list..
var childFirst = child.first;
var childLast = child.last;
var nextObject;
var previousObject;
@ -321,7 +327,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
if(index == this.children.length)
{
previousObject = this.last;
var updateLast = this;&#x2F;&#x2F;.parent;
var updateLast = this;
var prevLast = this.last;
while(updateLast)
{
@ -343,7 +349,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
nextObject = previousObject._iNext;
&#x2F;&#x2F; always true in this case
// always true in this case
if(nextObject)
{
nextObject._iPrev = childLast;
@ -352,19 +358,17 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
childFirst._iPrev = previousObject;
previousObject._iNext = childFirst;
this.children.splice(index, 0, child);
&#x2F;&#x2F; need to remove any render groups..
// need to remove any render groups..
if(this.__renderGroup)
{
&#x2F;&#x2F; being used by a renderTexture.. if it exists then it must be from a render texture;
// being used by a renderTexture.. if it exists then it must be from a render texture;
if(child.__renderGroup)child.__renderGroup.removeDisplayObjectAndChildren(child);
&#x2F;&#x2F; add them to the new render group..
// add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child);
}
console.log(this.children)
}
else
{
@ -372,35 +376,37 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
}
}
&#x2F;**
* Swaps the depth of 2 displayObjects
/**
* [NYI] Swaps the depth of 2 displayObjects
*
* @method swapChildren
* @param DisplayObject {DisplayObject}
* @param DisplayObject2 {DisplayObject}
*&#x2F;
* @param child {DisplayObject}
* @param child2 {DisplayObject}
* @private
*/
PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
{
&#x2F;*
/*
* this funtion needs to be recoded..
* can be done a lot faster..
*&#x2F;
*/
return;
&#x2F;&#x2F; need to fix this function :&#x2F;
&#x2F;*
&#x2F;&#x2F; TODO I already know this??
// need to fix this function :/
/*
// TODO I already know this??
var index = this.children.indexOf( child );
var index2 = this.children.indexOf( child2 );
if ( index !== -1 &amp;&amp; index2 !== -1 )
{
&#x2F;&#x2F; cool
// cool
&#x2F;*
/*
if(this.stage)
{
&#x2F;&#x2F; this is to satisfy the webGL batching..
&#x2F;&#x2F; TODO sure there is a nicer way to achieve this!
// this is to satisfy the webGL batching..
// TODO sure there is a nicer way to achieve this!
this.stage.__removeChild(child);
this.stage.__removeChild(child2);
@ -408,7 +414,7 @@ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
this.stage.__addChild(child2);
}
&#x2F;&#x2F; swap the positions..
// swap the positions..
this.children[index] = child2;
this.children[index2] = child;
@ -416,14 +422,15 @@ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2)
else
{
throw new Error(child + &quot; Both the supplied DisplayObjects must be a child of the caller &quot; + this);
}*&#x2F;
}*/
}
&#x2F;**
/**
* Returns the Child at the specified index
*
* @method getChildAt
* @param index {Number}
*&#x2F;
* @param index {Number} The index to get the child from
*/
PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
{
if(index &gt;= 0 &amp;&amp; index &lt; this.children.length)
@ -436,20 +443,20 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
}
}
&#x2F;**
/**
* Removes a child from the container.
*
* @method removeChild
* @param DisplayObject {DisplayObject}
*&#x2F;
* @param child {DisplayObject} The DisplayObject to remove
*/
PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{
var index = this.children.indexOf( child );
if ( index !== -1 )
{
&#x2F;&#x2F;console.log(&quot;&gt;&gt;&quot;)
&#x2F;&#x2F; unlink &#x2F;&#x2F;
&#x2F;&#x2F; modify the list..
var childFirst = child.first
// unlink //
// modify the list..
var childFirst = child.first;
var childLast = child.last;
var nextObject = childLast._iNext;
@ -461,7 +468,7 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast)
{
var tempLast = childFirst._iPrev;
&#x2F;&#x2F; need to make sure the parents last is updated too
// need to make sure the parents last is updated too
var updateLast = this;
while(updateLast.last == childLast.last)
{
@ -474,7 +481,7 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
childLast._iNext = null;
childFirst._iPrev = null;
&#x2F;&#x2F; update the stage reference..
// update the stage reference..
if(this.stage)
{
var tmpChild = child;
@ -487,7 +494,7 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
while(tmpChild)
}
&#x2F;&#x2F; webGL trim
// webGL trim
if(child.__renderGroup)
{
child.__renderGroup.removeDisplayObjectAndChildren(child);
@ -502,10 +509,12 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
}
}
&#x2F;**
/*
* Updates the container&#x27;s children&#x27;s transform for rendering
*
* @method updateTransform
* @private
*&#x2F;
*/
PIXI.DisplayObjectContainer.prototype.updateTransform = function()
{
if(!this.visible)return;
@ -517,7 +526,6 @@ PIXI.DisplayObjectContainer.prototype.updateTransform = function()
this.children[i].updateTransform();
}
}
</pre>
</div>
@ -527,13 +535,13 @@ PIXI.DisplayObjectContainer.prototype.updateTransform = function()
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>