minor tweaks

This commit is contained in:
Mat Groves 2014-01-15 13:15:39 +00:00
parent 9da560524f
commit adb403f929
2 changed files with 18 additions and 8 deletions

View file

@ -58,6 +58,8 @@ PIXI.InteractionManager = function(stage)
this.onTouchEnd = this.onTouchEnd.bind(this); this.onTouchEnd = this.onTouchEnd.bind(this);
this.onTouchMove = this.onTouchMove.bind(this); this.onTouchMove = this.onTouchMove.bind(this);
this.last = 0; this.last = 0;
this.currentCursor = "inherit";
}; };
// constructor // constructor
@ -219,8 +221,8 @@ PIXI.InteractionManager.prototype.update = function()
// loop through interactive objects! // loop through interactive objects!
var length = this.interactiveItems.length; var length = this.interactiveItems.length;
this.interactionDOMElement.style.cursor = 'inherit'; // return;
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
{ {
@ -243,7 +245,7 @@ PIXI.InteractionManager.prototype.update = function()
// loks like there was a hit! // loks like there was a hit!
if(item.__hit) if(item.__hit)
{ {
if(item.buttonMode) this.interactionDOMElement.style.cursor = item.defaultCursor; if(item.buttonMode) this.currentCursor = item.defaultCursor;
if(!item.__isOver) if(!item.__isOver)
{ {
@ -264,6 +266,12 @@ PIXI.InteractionManager.prototype.update = function()
} }
// ---> // --->
} }
if(this.currentCursor !== this.interactionDOMElement.style.cursor)
{
this.interactionDOMElement.style.cursor = this.currentCursor;
}
}; };
/** /**
@ -342,7 +350,7 @@ PIXI.InteractionManager.prototype.onMouseOut = function()
{ {
var length = this.interactiveItems.length; var length = this.interactiveItems.length;
this.interactionDOMElement.style.cursor = 'inherit'; this.currentCursor = 'inherit';
for (var i = 0; i < length; i++) for (var i = 0; i < length; i++)
{ {

View file

@ -177,18 +177,20 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
context.beginPath(); context.beginPath();
var tilePosition = this.tilePosition; var tilePositionX = this.tilePosition.x % this.tilingTexture.width;
var tilePositionY = this.tilePosition.y % this.tilingTexture.height;
var tileScale = this.tileScale; var tileScale = this.tileScale;
// console.log(tileScale.x) // console.log(tileScale.x)
// offset // offset
context.scale(tileScale.x,tileScale.y); context.scale(tileScale.x,tileScale.y);
context.translate(tilePosition.x, tilePosition.y); context.translate(tilePositionX, tilePositionY);
context.fillStyle = this.__tilePattern; context.fillStyle = this.__tilePattern;
context.fillRect(-tilePosition.x,-tilePosition.y,this.width / tileScale.x, this.height / tileScale.y); context.fillRect(-tilePositionX,-tilePositionY,this.width / tileScale.x, this.height / tileScale.y);
context.scale(1/tileScale.x, 1/tileScale.y); context.scale(1/tileScale.x, 1/tileScale.y);
context.translate(-tilePosition.x, -tilePosition.y); context.translate(-tilePositionX, -tilePositionY);
context.closePath(); context.closePath();
}; };