2017-07-27 13:22:44 +00:00
|
|
|
var NOOP = require('../utils/NOOP');
|
2017-07-25 03:10:50 +00:00
|
|
|
|
2017-07-27 13:22:44 +00:00
|
|
|
// Phaser.Input.InteractiveObject
|
2017-07-25 03:10:50 +00:00
|
|
|
|
2017-07-27 13:22:44 +00:00
|
|
|
var InteractiveObject = function (gameObject, hitArea, hitAreaCallback)
|
|
|
|
{
|
|
|
|
return {
|
2017-07-25 03:10:50 +00:00
|
|
|
|
2017-07-27 13:22:44 +00:00
|
|
|
gameObject: gameObject,
|
2017-07-25 03:10:50 +00:00
|
|
|
|
2017-07-27 13:22:44 +00:00
|
|
|
enabled: true,
|
|
|
|
draggable: false,
|
2017-07-27 17:24:04 +00:00
|
|
|
dropZone: false,
|
2017-07-25 03:10:50 +00:00
|
|
|
|
2017-07-27 23:29:04 +00:00
|
|
|
target: null,
|
|
|
|
|
2017-07-28 17:22:57 +00:00
|
|
|
camera: null,
|
|
|
|
|
2017-07-27 13:22:44 +00:00
|
|
|
hitArea: hitArea,
|
|
|
|
hitAreaCallback: hitAreaCallback,
|
2017-07-25 03:10:50 +00:00
|
|
|
|
2017-07-27 13:22:44 +00:00
|
|
|
localX: 0,
|
|
|
|
localY: 0,
|
2017-07-25 03:10:50 +00:00
|
|
|
|
2017-07-27 02:40:58 +00:00
|
|
|
// 0 = Not being dragged
|
|
|
|
// 1 = Being checked for dragging
|
|
|
|
// 2 = Being dragged
|
2017-07-27 13:22:44 +00:00
|
|
|
dragState: 0,
|
|
|
|
|
2017-07-27 23:46:37 +00:00
|
|
|
dragStartX: 0,
|
|
|
|
dragStartY: 0,
|
|
|
|
|
2017-07-27 13:22:44 +00:00
|
|
|
dragX: 0,
|
|
|
|
dragY: 0,
|
|
|
|
|
|
|
|
// Callbacks
|
|
|
|
|
|
|
|
callbackContext: gameObject,
|
|
|
|
|
|
|
|
// gameObject, pointer, x, y
|
|
|
|
onUp: NOOP,
|
|
|
|
|
|
|
|
// gameObject, pointer, x, y
|
|
|
|
onDown: NOOP,
|
|
|
|
|
|
|
|
// gameObject, pointer, x, y
|
|
|
|
onOver: NOOP,
|
|
|
|
|
|
|
|
// gameObject, pointer
|
|
|
|
onOut: NOOP,
|
|
|
|
|
|
|
|
// gameObject, pointer, x, y
|
|
|
|
onMove: NOOP,
|
|
|
|
|
|
|
|
onDragStart: NOOP,
|
|
|
|
onDrag: NOOP,
|
|
|
|
onDragEnd: NOOP
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
2017-07-18 01:36:45 +00:00
|
|
|
|
|
|
|
module.exports = InteractiveObject;
|