mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Input Handler working. Dragging, sliding, click detection, multi-touch. Appears to be an issue with bringToTop but it's most likely a problem with the swapChild function rather than Input.
This commit is contained in:
@@ -91,6 +91,17 @@ Phaser.World.prototype = {
|
||||
|
||||
},
|
||||
|
||||
bringToTop: function (child) {
|
||||
|
||||
if (child !== this._stage.last)
|
||||
{
|
||||
this.swapChildren(child, this._stage.last);
|
||||
}
|
||||
|
||||
return child;
|
||||
|
||||
},
|
||||
|
||||
swapChildren: function (child1, child2) {
|
||||
|
||||
if (child1 === child2 || !child1.parent || !child2.parent)
|
||||
|
||||
@@ -319,6 +319,19 @@ Phaser.Sprite.prototype.getLocalUnmodifiedPosition = function(p, x, y) {
|
||||
|
||||
}
|
||||
|
||||
Phaser.Sprite.prototype.bringToTop = function() {
|
||||
|
||||
if (this.group)
|
||||
{
|
||||
this.group.bringToTop(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.game.world.bringToTop(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Phaser.Sprite.prototype.getBounds = function(rect) {
|
||||
|
||||
rect = rect || new Phaser.Rectangle;
|
||||
|
||||
@@ -672,7 +672,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
if (this.dragFromCenter)
|
||||
{
|
||||
this.sprite.transform.centerOn(pointer.worldX, pointer.worldY);
|
||||
// this.sprite.transform.centerOn(pointer.worldX, pointer.worldY);
|
||||
this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user