Set customHitArea to false if shape is not defined

In setHitArea method, use setHitAreaFromTexture if shape is undefined. Suppose that it is not a case of `customHitArea`
This commit is contained in:
Rex 2019-06-22 09:37:49 +08:00
parent 96f96a7258
commit 16a038674f

View file

@ -2101,6 +2101,7 @@ var InputPlugin = new Class({
var cursor = false; var cursor = false;
var useHandCursor = false; var useHandCursor = false;
var pixelPerfect = false; var pixelPerfect = false;
var customHitArea = true;
// Config object? // Config object?
if (IsPlainObject(shape)) if (IsPlainObject(shape))
@ -2127,6 +2128,7 @@ var InputPlugin = new Class({
if (!shape || !callback) if (!shape || !callback)
{ {
this.setHitAreaFromTexture(gameObjects); this.setHitAreaFromTexture(gameObjects);
customHitArea = false;
} }
} }
else if (typeof shape === 'function' && !callback) else if (typeof shape === 'function' && !callback)
@ -2147,7 +2149,7 @@ var InputPlugin = new Class({
var io = (!gameObject.input) ? CreateInteractiveObject(gameObject, shape, callback) : gameObject.input; var io = (!gameObject.input) ? CreateInteractiveObject(gameObject, shape, callback) : gameObject.input;
io.customHitArea = true; io.customHitArea = customHitArea;
io.dropZone = dropZone; io.dropZone = dropZone;
io.cursor = (useHandCursor) ? 'pointer' : cursor; io.cursor = (useHandCursor) ? 'pointer' : cursor;