Added customHitArea boolean property

This commit is contained in:
Richard Davey 2019-04-24 11:21:52 +01:00
parent 53c14df798
commit 507bb6a215
3 changed files with 5 additions and 0 deletions

View file

@ -38,6 +38,9 @@ var CreateInteractiveObject = function (gameObject, hitArea, hitAreaCallback)
hitArea: hitArea,
hitAreaCallback: hitAreaCallback,
// Has the dev specified their own shape, or is this bound to the texture size?
customHitArea: false,
localX: 0,
localY: 0,

View file

@ -1764,6 +1764,7 @@ var InputPlugin = new Class({
var io = (!gameObject.input) ? CreateInteractiveObject(gameObject, shape, callback) : gameObject.input;
io.customHitArea = true;
io.dropZone = dropZone;
io.cursor = (useHandCursor) ? 'pointer' : cursor;

View file

@ -11,6 +11,7 @@
* @property {Phaser.Cameras.Scene2D.Camera} camera - The most recent Camera to be tested against this Interactive Object.
* @property {any} hitArea - The hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle.
* @property {Phaser.Input.Types.HitAreaCallback} hitAreaCallback - The 'contains' check callback that the hit area shape will use for all hit tests.
* @property {boolean} customHitArea - Was the hitArea for this Interactive Object created based on texture size (false), or a custom shape? (true)
* @property {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
* @property {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
* @property {(0|1|2)} dragState - The current drag state of this Interactive Object. 0 = Not being dragged, 1 = being checked for drag, or 2 = being actively dragged.