buttonMode added and documented
This commit is contained in:
parent
c1240a1da7
commit
164e35e5f0
26 changed files with 634 additions and 140 deletions
|
@ -206,6 +206,12 @@ PIXI.DisplayObject = function()
|
|||
|
||||
// [readonly] best not to toggle directly! use setInteractive()
|
||||
this.interactive = false;
|
||||
|
||||
/**
|
||||
* This is used to indicate if the displayObject should display a mouse hand cursor on rollover
|
||||
* @property buttonMode
|
||||
* @type Boolean
|
||||
*/
|
||||
this.buttonMode = false;
|
||||
|
||||
/*
|
||||
|
|
|
@ -261,7 +261,7 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
var len = this.interactiveItems.length;
|
||||
|
||||
for (var i=0; i < this.interactiveItems.length; i++) {
|
||||
this.interactiveItems[i].interactiveChildren = true;
|
||||
this.interactiveItems[i].interactiveChildren = false;
|
||||
}
|
||||
|
||||
this.interactiveItems = [];
|
||||
|
@ -274,6 +274,8 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
// loop through interactive objects!
|
||||
var length = this.interactiveItems.length;
|
||||
|
||||
if(this.target)this.target.view.style.cursor = "default";
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
var item = this.interactiveItems[i];
|
||||
|
@ -282,6 +284,8 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
// OPTIMISATION - only calculate every time if the mousemove function exists..
|
||||
// OK so.. does the object have any other interactive functions?
|
||||
// hit-test the clip!
|
||||
|
||||
|
||||
if(item.mouseover || item.mouseout || item.buttonMode)
|
||||
{
|
||||
// ok so there are some functions so lets hit test it..
|
||||
|
@ -290,9 +294,11 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
// loks like there was a hit!
|
||||
if(item.__hit)
|
||||
{
|
||||
if(item.buttonMode)this.target.view.style.cursor = "pointer";
|
||||
|
||||
if(!item.__isOver)
|
||||
{
|
||||
if(item.buttonMode)this.target.view.style.cursor = "pointer";
|
||||
|
||||
if(item.mouseover)item.mouseover(this.mouse);
|
||||
item.__isOver = true;
|
||||
}
|
||||
|
@ -302,7 +308,6 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
if(item.__isOver)
|
||||
{
|
||||
// roll out!
|
||||
if(item.buttonMode)this.target.view.style.cursor = "default";
|
||||
if(item.mouseout)item.mouseout(this.mouse);
|
||||
item.__isOver = false;
|
||||
}
|
||||
|
@ -451,6 +456,8 @@ PIXI.InteractionManager.prototype.hitTest = function(item, interactionData)
|
|||
|
||||
if(y > y1 && y < y1 + height)
|
||||
{
|
||||
// set the target property if a hit is true!
|
||||
interactionData.target = item
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue