mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
Fixes for drawing of hitboxes in input.debug
- Offset hitboxes now draw properly when debug enabled for all shapes - Addresses issue #4722
This commit is contained in:
parent
c25331cf30
commit
174dcfdada
1 changed files with 9 additions and 1 deletions
|
@ -2403,14 +2403,20 @@ var InputPlugin = new Class({
|
|||
debug = null;
|
||||
}
|
||||
|
||||
var offsetx = 0;
|
||||
var offsety = 0;
|
||||
switch (shapeType)
|
||||
{
|
||||
case GEOM_CONST.CIRCLE:
|
||||
debug = factory.arc(0, 0, shape.radius);
|
||||
offsetx = shape.x - shape.radius;
|
||||
offsety = shape.y - shape.radius;
|
||||
break;
|
||||
|
||||
case GEOM_CONST.ELLIPSE:
|
||||
debug = factory.ellipse(0, 0, shape.width, shape.height);
|
||||
offsetx = shape.x - shape.width / 2;
|
||||
offsety = shape.y - shape.height / 2;
|
||||
break;
|
||||
|
||||
case GEOM_CONST.LINE:
|
||||
|
@ -2423,6 +2429,8 @@ var InputPlugin = new Class({
|
|||
|
||||
case GEOM_CONST.RECTANGLE:
|
||||
debug = factory.rectangle(0, 0, shape.width, shape.height);
|
||||
offsetx = shape.x;
|
||||
offsety = shape.y;
|
||||
break;
|
||||
|
||||
case GEOM_CONST.TRIANGLE:
|
||||
|
@ -2441,7 +2449,7 @@ var InputPlugin = new Class({
|
|||
debug.setDisplayOrigin(gameObject.displayOriginX, gameObject.displayOriginY);
|
||||
debug.setRotation(gameObject.rotation);
|
||||
debug.setScale(gameObject.scaleX, gameObject.scaleY);
|
||||
debug.setPosition(gameObject.x, gameObject.y);
|
||||
debug.setPosition(gameObject.x + offsetx, gameObject.y + offsety);
|
||||
debug.setScrollFactor(gameObject.scrollFactorX, gameObject.scrollFactorY);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue