Exposed buttons event property.

This commit is contained in:
Richard Davey 2017-07-25 04:53:23 +01:00
parent e17118c1aa
commit 1b4e53d06f
10 changed files with 23 additions and 36 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: '38e2f870-70e5-11e7-b8c1-e1e51940ad94'
build: 'ef2515e0-70eb-11e7-ad8e-3beabf57a909'
};
module.exports = CHECKSUM;

View file

@ -29,27 +29,27 @@ var InteractiveObject = new Class({
// onDragEnd: NOOP
},
onUp: function ()
onUp: function (gameObject, pointer, x, y)
{
// Empty by default. Override via setCallback.
},
onDown: function ()
onDown: function (gameObject, pointer, x, y)
{
// Empty by default. Override via setCallback.
},
onOver: function ()
onOver: function (gameObject, pointer, x, y)
{
// Empty by default. Override via setCallback.
},
onOut: function ()
onOut: function (gameObject, pointer)
{
// Empty by default. Override via setCallback.
},
onMove: function ()
onMove: function (gameObject, pointer, x, y)
{
// Empty by default. Override via setCallback.
},

View file

@ -2,6 +2,8 @@ var Class = require('../../utils/Class');
// Drag Events
// https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API
// Mouse Events
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
var SceneInputManager = new Class({

View file

@ -22,32 +22,6 @@ var ProcessMoveEvents = function (pointer)
}
/*
var i;
var interactiveObject;
if (currentlyOver.length === 0)
{
// Dispatch MOVE event, even though pointer isn't over anything
this.events.dispatch(new InputEvent.MOVE(pointer));
}
else
{
// Go through all objects the pointer is over and dispatch them
for (i = 0; i < currentlyOver.length; i++)
{
interactiveObject = currentlyOver[i];
this.events.dispatch(new InputEvent.MOVE(pointer, interactiveObject.gameObject, currentlyOver));
this.childOnMove(pointer, interactiveObject);
if (this.topOnly)
{
break;
}
}
}
// Check the list of Draggable Items
for (i = 0; i < this.children.draggable.length; i++)
{

View file

@ -17,8 +17,8 @@ var PointerDownEvent = new Class({
// The native DOM event (MouseEvent, TouchEvent, etc)
this.event = pointer.event;
// The button that was released. This is read directly from the DOM event.
this.button = pointer.event.button;
// The button/s used in this event. This is read directly from the DOM event.
this.buttons = pointer.event.buttons;
// The x/y coordinates of the event
this.x = pointer.x;

View file

@ -17,6 +17,9 @@ var PointerMoveEvent = new Class({
// The native DOM event (MouseEvent, TouchEvent, etc)
this.event = pointer.event;
// The button/s used in this event. This is read directly from the DOM event.
this.buttons = pointer.event.buttons;
// The x/y coordinates of the event
this.x = pointer.x;
this.y = pointer.y;

View file

@ -17,6 +17,9 @@ var PointerOutEvent = new Class({
// The native DOM event (MouseEvent, TouchEvent, etc)
this.event = pointer.event;
// The button/s used in this event. This is read directly from the DOM event.
this.buttons = pointer.event.buttons;
// The x/y coordinates of the event
this.x = pointer.x;
this.y = pointer.y;

View file

@ -17,6 +17,9 @@ var PointerOverEvent = new Class({
// The native DOM event (MouseEvent, TouchEvent, etc)
this.event = pointer.event;
// The button/s used in this event. This is read directly from the DOM event.
this.buttons = pointer.event.buttons;
// The x/y coordinates of the event
this.x = pointer.x;
this.y = pointer.y;

View file

@ -17,8 +17,8 @@ var PointerUpEvent = new Class({
// The native DOM event (MouseEvent, TouchEvent, etc)
this.event = pointer.event;
// The button that was released. This is read directly from the DOM event.
this.button = pointer.event.button;
// The button/s used in this event. This is read directly from the DOM event.
this.buttons = pointer.event.buttons;
// The x/y coordinates of the event
this.x = pointer.x;

View file

@ -13,6 +13,7 @@ var InputManager = new Class({
SceneInputManager.call(this, scene, game);
},
/*
childOnMove: function (pointer, interactiveObject)
{
interactiveObject.onMove(interactiveObject.gameObject, pointer);
@ -53,6 +54,7 @@ var InputManager = new Class({
interactiveObject.onDragEnd(interactiveObject.gameObject, pointer);
}
*/
});