mirror of
https://github.com/photonstorm/phaser
synced 2025-02-01 06:43:35 +00:00
Fix #3112
This commit is contained in:
parent
9c9b4f69b3
commit
1f07ad203a
1 changed files with 49 additions and 3 deletions
|
@ -8,9 +8,10 @@ var GameObject = require('../GameObject');
|
|||
var Rectangle = require('../../geom/rectangle/Rectangle');
|
||||
var RectangleContains = require('../../geom/rectangle/Contains');
|
||||
|
||||
// A Zone is a non-rendering Game Object that has a position and size.
|
||||
// A Zone is a non-rendering rectangular Game Object that has a position and size.
|
||||
// It has no texture and never renders, but does live on the display list and
|
||||
// can be moved, scaled and rotated like any other Game Object.
|
||||
|
||||
// The default origin is 0.5, the center of the Zone, the same as with Game Objects.
|
||||
// It's useful for linking to drop zones and input hit areas and has a couple of helper methods specifically for this.
|
||||
// Also useful for object overlap checks, or as a base for your own non-displaying objects.
|
||||
|
@ -23,7 +24,6 @@ var Zone = new Class({
|
|||
Components.GetBounds,
|
||||
Components.Origin,
|
||||
Components.ScaleMode,
|
||||
Components.Size,
|
||||
Components.Transform,
|
||||
Components.ScrollFactor,
|
||||
Components.Visible
|
||||
|
@ -39,11 +39,57 @@ var Zone = new Class({
|
|||
GameObject.call(this, scene, 'Zone');
|
||||
|
||||
this.setPosition(x, y);
|
||||
this.setSize(width, height);
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
this.blendMode = BlendModes.NORMAL;
|
||||
},
|
||||
|
||||
displayWidth: {
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this.scaleX * this.width;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.scaleX = value / this.width;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
displayHeight: {
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this.scaleY * this.height;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.scaleY = value / this.height;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
setSize: function (width, height)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setDisplaySize: function (width, height)
|
||||
{
|
||||
this.displayWidth = width;
|
||||
this.displayHeight = height;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
// Centered on the Zones x/y
|
||||
setCircleDropZone: function (radius)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue