Docs updated Builds updated
This commit is contained in:
parent
b1b2e417a3
commit
69b3be322e
93 changed files with 6214 additions and 1190 deletions
|
@ -53,12 +53,16 @@
|
|||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/Circle.html">Circle</a></li>
|
||||
|
||||
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/Ellipse.html">Ellipse</a></li>
|
||||
|
||||
<li><a href="../classes/Graphics.html">Graphics</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
@ -153,6 +157,9 @@
|
|||
*/
|
||||
PIXI.DisplayObject = function()
|
||||
{
|
||||
this.last = this;
|
||||
this.first = this;
|
||||
|
||||
/**
|
||||
* The coordinate of the object relative to the local coordinates of the parent.
|
||||
* @property position
|
||||
|
@ -234,7 +241,7 @@ PIXI.DisplayObject = function()
|
|||
this.renderable = false;
|
||||
|
||||
// [readonly] best not to toggle directly! use setInteractive()
|
||||
this.interactive = false;
|
||||
this._interactive = false;
|
||||
|
||||
/**
|
||||
* This is used to indicate if the displayObject should display a mouse hand cursor on rollover
|
||||
|
@ -332,18 +339,214 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'visible', {
|
|||
});*/
|
||||
|
||||
/**
|
||||
* Indicates if the sprite will have touch and mouse interactivity. It is false by default
|
||||
* [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default
|
||||
* Instead of using this function you can now simply set the interactive property to true or false
|
||||
* @method setInteractive
|
||||
* @param interactive {Boolean}
|
||||
*/
|
||||
PIXI.DisplayObject.prototype.setInteractive = function(interactive)
|
||||
{
|
||||
this.interactive = interactive;
|
||||
// TODO more to be done here..
|
||||
// need to sort out a re-crawl!
|
||||
if(this.stage)this.stage.dirty = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the sprite will have touch and mouse interactivity. It is false by default
|
||||
* @property interactive
|
||||
* @type Boolean
|
||||
*/
|
||||
Object.defineProperty(PIXI.DisplayObject.prototype, 'interactive', {
|
||||
get: function() {
|
||||
return this._interactive;
|
||||
},
|
||||
set: function(value) {
|
||||
this._interactive = value;
|
||||
|
||||
// TODO more to be done here..
|
||||
// need to sort out a re-crawl!
|
||||
if(this.stage)this.stage.dirty = true;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it.
|
||||
* In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping.
|
||||
* To remove a mask, set this property to null.
|
||||
* @property mask
|
||||
* @type PIXI.Graphics
|
||||
*/
|
||||
Object.defineProperty(PIXI.DisplayObject.prototype, 'mask', {
|
||||
get: function() {
|
||||
return this._mask;
|
||||
},
|
||||
set: function(value) {
|
||||
|
||||
this._mask = value;
|
||||
|
||||
if(value)
|
||||
{
|
||||
this.addFilter(value)
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeFilter();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* private
|
||||
*/
|
||||
PIXI.DisplayObject.prototype.addFilter = function(mask)
|
||||
{
|
||||
if(this.filter)return;
|
||||
this.filter = true;
|
||||
|
||||
|
||||
// insert a filter block..
|
||||
var start = new PIXI.FilterBlock();
|
||||
var end = new PIXI.FilterBlock();
|
||||
|
||||
|
||||
start.mask = mask;
|
||||
end.mask = mask;
|
||||
|
||||
start.id = end.id = county
|
||||
|
||||
county++;
|
||||
|
||||
start.first = start.last = this;
|
||||
end.first = end.last = this;
|
||||
|
||||
start.open = true;
|
||||
|
||||
/*
|
||||
*
|
||||
* insert start
|
||||
*
|
||||
*/
|
||||
|
||||
var childFirst = start
|
||||
var childLast = start
|
||||
var nextObject;
|
||||
var previousObject;
|
||||
|
||||
previousObject = this.first._iPrev;
|
||||
|
||||
if(previousObject)
|
||||
{
|
||||
nextObject = previousObject._iNext;
|
||||
childFirst._iPrev = previousObject;
|
||||
previousObject._iNext = childFirst;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextObject = this;
|
||||
}
|
||||
|
||||
if(nextObject)
|
||||
{
|
||||
nextObject._iPrev = childLast;
|
||||
childLast._iNext = nextObject;
|
||||
}
|
||||
|
||||
|
||||
// now insert the end filter block..
|
||||
|
||||
/*
|
||||
*
|
||||
* insert end filter
|
||||
*
|
||||
*/
|
||||
var childFirst = end
|
||||
var childLast = end
|
||||
var nextObject = null;
|
||||
var previousObject = null;
|
||||
|
||||
previousObject = this.last;
|
||||
nextObject = previousObject._iNext;
|
||||
|
||||
if(nextObject)
|
||||
{
|
||||
nextObject._iPrev = childLast;
|
||||
childLast._iNext = nextObject;
|
||||
}
|
||||
|
||||
childFirst._iPrev = previousObject;
|
||||
previousObject._iNext = childFirst;
|
||||
|
||||
var updateLast = this;
|
||||
|
||||
var prevLast = this.last;
|
||||
while(updateLast)
|
||||
{
|
||||
if(updateLast.last == prevLast)
|
||||
{
|
||||
updateLast.last = end;
|
||||
}
|
||||
updateLast = updateLast.parent;
|
||||
}
|
||||
|
||||
this.first = start;
|
||||
|
||||
// if webGL...
|
||||
if(this.__renderGroup)
|
||||
{
|
||||
this.__renderGroup.addFilterBlocks(start, end);
|
||||
}
|
||||
|
||||
mask.renderable = false;
|
||||
|
||||
}
|
||||
|
||||
PIXI.DisplayObject.prototype.removeFilter = function()
|
||||
{
|
||||
if(!this.filter)return;
|
||||
this.filter = false;
|
||||
|
||||
// modify the list..
|
||||
var startBlock = this.first;
|
||||
|
||||
var nextObject = startBlock._iNext;
|
||||
var previousObject = startBlock._iPrev;
|
||||
|
||||
if(nextObject)nextObject._iPrev = previousObject;
|
||||
if(previousObject)previousObject._iNext = nextObject;
|
||||
|
||||
this.first = startBlock._iNext;
|
||||
|
||||
|
||||
// remove the end filter
|
||||
var lastBlock = this.last;
|
||||
|
||||
var nextObject = lastBlock._iNext;
|
||||
var previousObject = lastBlock._iPrev;
|
||||
|
||||
if(nextObject)nextObject._iPrev = previousObject;
|
||||
previousObject._iNext = nextObject;
|
||||
|
||||
// this is always true too!
|
||||
// if(this.last == lastBlock)
|
||||
//{
|
||||
var tempLast = lastBlock._iPrev;
|
||||
// need to make sure the parents last is updated too
|
||||
var updateLast = this;
|
||||
while(updateLast.last == lastBlock)
|
||||
{
|
||||
updateLast.last = tempLast;
|
||||
updateLast = updateLast.parent;
|
||||
if(!updateLast)break;
|
||||
}
|
||||
|
||||
var mask = startBlock.mask
|
||||
mask.renderable = true;
|
||||
|
||||
// if webGL...
|
||||
if(this.__renderGroup)
|
||||
{
|
||||
this.__renderGroup.removeFilterBlocks(startBlock, lastBlock);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
@ -367,24 +570,21 @@ PIXI.DisplayObject.prototype.updateTransform = function()
|
|||
localTransform[3] = this._sr * this.scale.x;
|
||||
localTransform[4] = this._cr * this.scale.y;
|
||||
|
||||
///AAARR GETTER SETTTER!
|
||||
//localTransform[2] = this.position.x;
|
||||
//localTransform[5] = this.position.y;
|
||||
// TODO --> do we even need a local matrix???
|
||||
|
||||
var px = this.pivot.x;
|
||||
var py = this.pivot.y;
|
||||
|
||||
///AAARR GETTER SETTTER!
|
||||
localTransform[2] = this.position.x - localTransform[0] * px - py * localTransform[1];
|
||||
localTransform[5] = this.position.y - localTransform[4] * py - px * localTransform[3];
|
||||
|
||||
// Cache the matrix values (makes for huge speed increases!)
|
||||
var a00 = localTransform[0], a01 = localTransform[1], a02 = localTransform[2],
|
||||
a10 = localTransform[3], a11 = localTransform[4], a12 = localTransform[5],
|
||||
var a00 = localTransform[0], a01 = localTransform[1], a02 = this.position.x - localTransform[0] * px - py * localTransform[1],
|
||||
a10 = localTransform[3], a11 = localTransform[4], a12 = this.position.y - localTransform[4] * py - px * localTransform[3],
|
||||
|
||||
b00 = parentTransform[0], b01 = parentTransform[1], b02 = parentTransform[2],
|
||||
b10 = parentTransform[3], b11 = parentTransform[4], b12 = parentTransform[5];
|
||||
|
||||
localTransform[2] = a02
|
||||
localTransform[5] = a12
|
||||
|
||||
worldTransform[0] = b00 * a00 + b01 * a10;
|
||||
worldTransform[1] = b00 * a01 + b01 * a11;
|
||||
worldTransform[2] = b00 * a02 + b01 * a12 + b02;
|
||||
|
@ -397,7 +597,6 @@ PIXI.DisplayObject.prototype.updateTransform = function()
|
|||
// mat3.multiply(this.localTransform, this.parent.worldTransform, this.worldTransform);
|
||||
this.worldAlpha = this.alpha * this.parent.worldAlpha;
|
||||
|
||||
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue