Documentation Fix

This commit is contained in:
Mat Groves 2013-06-19 20:43:52 +01:00
parent 8093792ed5
commit 4dab30ee17
85 changed files with 16528 additions and 1633 deletions

View file

@ -63,14 +63,20 @@
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
<li><a href="..&#x2F;classes/JsonLoader.html">JsonLoader</a></li>
<li><a href="..&#x2F;classes/MovieClip.html">MovieClip</a></li>
<li><a href="..&#x2F;classes/Point.html">Point</a></li>
<li><a href="..&#x2F;classes/Polygon.html">Polygon</a></li>
<li><a href="..&#x2F;classes/Rectangle.html">Rectangle</a></li>
<li><a href="..&#x2F;classes/RenderTexture.html">RenderTexture</a></li>
<li><a href="..&#x2F;classes/Spine.html">Spine</a></li>
<li><a href="..&#x2F;classes/Sprite.html">Sprite</a></li>
<li><a href="..&#x2F;classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
@ -197,25 +203,27 @@ PIXI.InteractionManager.prototype.collectInteractiveSprite = function(displayObj
{
var child = children[i];
&#x2F;&#x2F; push all interactive bits
if(child.interactive)
{
iParent.interactiveChildren = true;
&#x2F;&#x2F;child.__iParent = iParent;
this.interactiveItems.push(child);
if(child.children.length &gt; 0)
if(child.visible) {
&#x2F;&#x2F; push all interactive bits
if(child.interactive)
{
this.collectInteractiveSprite(child, child);
iParent.interactiveChildren = true;
&#x2F;&#x2F;child.__iParent = iParent;
this.interactiveItems.push(child);
if(child.children.length &gt; 0)
{
this.collectInteractiveSprite(child, child);
}
}
}
else
{
child.__iParent = null;
if(child.children.length &gt; 0)
else
{
this.collectInteractiveSprite(child, iParent);
child.__iParent = null;
if(child.children.length &gt; 0)
{
this.collectInteractiveSprite(child, iParent);
}
}
}
}
@ -325,8 +333,6 @@ PIXI.InteractionManager.prototype.update = function()
PIXI.InteractionManager.prototype.onMouseMove = function(event)
{
event.preventDefault();
&#x2F;&#x2F; TODO optimize by not check EVERY TIME! maybe half as often? &#x2F;&#x2F;
var rect = this.target.view.getBoundingClientRect();
@ -351,8 +357,6 @@ PIXI.InteractionManager.prototype.onMouseMove = function(event)
PIXI.InteractionManager.prototype.onMouseDown = function(event)
{
event.preventDefault();
&#x2F;&#x2F; loop through inteaction tree...
&#x2F;&#x2F; hit test each item! -&gt;
&#x2F;&#x2F; get interactive items under point??
@ -389,7 +393,6 @@ PIXI.InteractionManager.prototype.onMouseDown = function(event)
PIXI.InteractionManager.prototype.onMouseUp = function(event)
{
event.preventDefault();
var global = this.mouse.global;
@ -436,27 +439,66 @@ PIXI.InteractionManager.prototype.hitTest = function(item, interactionData)
var global = interactionData.global;
if(!item.visible)return false;
if(item instanceof PIXI.Sprite)
var isSprite = (item instanceof PIXI.Sprite),
worldTransform = item.worldTransform,
a00 = worldTransform[0], a01 = worldTransform[1], a02 = worldTransform[2],
a10 = worldTransform[3], a11 = worldTransform[4], a12 = worldTransform[5],
id = 1 &#x2F; (a00 * a11 + a01 * -a10),
x = a11 * id * global.x + -a01 * id * global.y + (a12 * a01 - a02 * a11) * id,
y = a00 * id * global.y + -a10 * id * global.x + (-a12 * a00 + a02 * a10) * id;
&#x2F;&#x2F;a sprite or display object with a hit area defined
if(item.hitArea)
{
var worldTransform = item.worldTransform;
var a00 = worldTransform[0], a01 = worldTransform[1], a02 = worldTransform[2],
a10 = worldTransform[3], a11 = worldTransform[4], a12 = worldTransform[5],
id = 1 &#x2F; (a00 * a11 + a01 * -a10);
var x = a11 * id * global.x + -a01 * id * global.y + (a12 * a01 - a02 * a11) * id;
var y = a00 * id * global.y + -a10 * id * global.x + (-a12 * a00 + a02 * a10) * id;
var width = item.texture.frame.width;
var height = item.texture.frame.height;
var x1 = -width * item.anchor.x;
var hitArea = item.hitArea;
&#x2F;&#x2F;Polygon hit area
if(item.hitArea instanceof PIXI.Polygon) {
var inside = false;
&#x2F;&#x2F; use some raycasting to test hits
&#x2F;&#x2F; https:&#x2F;&#x2F;github.com&#x2F;substack&#x2F;point-in-polygon&#x2F;blob&#x2F;master&#x2F;index.js
for(var i = 0, j = item.hitArea.points.length - 1; i &lt; item.hitArea.points.length; j = i++) {
var xi = item.hitArea.points[i].x, yi = item.hitArea.points[i].y,
xj = item.hitArea.points[j].x, yj = item.hitArea.points[j].y,
intersect = ((yi &gt; y) != (yj &gt; y)) &amp;&amp; (x &lt; (xj - xi) * (y - yi) &#x2F; (yj - yi) + xi);
if(intersect) inside = !inside;
}
if(inside) {
if(isSprite) interactionData.target = item;
return true;
}
}
&#x2F;&#x2F;Rectangle hit area
else {
var x1 = hitArea.x;
if(x &gt; x1 &amp;&amp; x &lt; x1 + hitArea.width)
{
var y1 = hitArea.y;
if(y &gt; y1 &amp;&amp; y &lt; y1 + hitArea.height)
{
if(isSprite) interactionData.target = item;
return true;
}
}
}
}
&#x2F;&#x2F; a sprite with no hitarea defined
else if(isSprite)
{
var width = item.texture.frame.width,
height = item.texture.frame.height,
x1 = -width * item.anchor.x,
y1;
if(x &gt; x1 &amp;&amp; x &lt; x1 + width)
{
var y1 = -height * item.anchor.y;
y1 = -height * item.anchor.y;
if(y &gt; y1 &amp;&amp; y &lt; y1 + height)
{
&#x2F;&#x2F; set the target property if a hit is true!
@ -465,30 +507,7 @@ PIXI.InteractionManager.prototype.hitTest = function(item, interactionData)
}
}
}
else if(item.hitArea)
{
var worldTransform = item.worldTransform;
var hitArea = item.hitArea;
var a00 = worldTransform[0], a01 = worldTransform[1], a02 = worldTransform[2],
a10 = worldTransform[3], a11 = worldTransform[4], a12 = worldTransform[5],
id = 1 &#x2F; (a00 * a11 + a01 * -a10);
var x = a11 * id * global.x + -a01 * id * global.y + (a12 * a01 - a02 * a11) * id;
var y = a00 * id * global.y + -a10 * id * global.x + (-a12 * a00 + a02 * a10) * id;
var x1 = hitArea.x;
if(x &gt; x1 &amp;&amp; x &lt; x1 + hitArea.width)
{
var y1 = hitArea.y;
if(y &gt; y1 &amp;&amp; y &lt; y1 + hitArea.height)
{
return true;
}
}
}
var length = item.children.length;
for (var i = 0; i &lt; length; i++)
@ -497,7 +516,7 @@ PIXI.InteractionManager.prototype.hitTest = function(item, interactionData)
var hit = this.hitTest(tempItem, interactionData);
if(hit)return true;
}
return false;
}
@ -505,8 +524,6 @@ PIXI.InteractionManager.prototype.hitTest = function(item, interactionData)
PIXI.InteractionManager.prototype.onTouchMove = function(event)
{
event.preventDefault();
var rect = this.target.view.getBoundingClientRect();
var changedTouches = event.changedTouches;
@ -530,7 +547,6 @@ PIXI.InteractionManager.prototype.onTouchMove = function(event)
PIXI.InteractionManager.prototype.onTouchStart = function(event)
{
event.preventDefault();
var rect = this.target.view.getBoundingClientRect();
var changedTouches = event.changedTouches;
@ -572,9 +588,6 @@ PIXI.InteractionManager.prototype.onTouchStart = function(event)
PIXI.InteractionManager.prototype.onTouchEnd = function(event)
{
event.preventDefault();
var rect = this.target.view.getBoundingClientRect();
var changedTouches = event.changedTouches;