Added metaKey support

This commit is contained in:
Richard Davey 2018-11-12 23:00:56 +00:00
parent 2f4f0d89ad
commit d8b0bf7a29
2 changed files with 13 additions and 0 deletions

View file

@ -112,6 +112,17 @@ var Key = new Class({
*/ */
this.shiftKey = false; this.shiftKey = false;
/**
* The down state of the Meta key, if pressed at the same time as this key.
* On a Mac the Meta Key is the Command key. On Windows keyboards, it's the Windows key.
*
* @name Phaser.Input.Keyboard.Key#metaKey
* @type {boolean}
* @default false
* @since 3.16.0
*/
this.metaKey = false;
/** /**
* The location of the modifier key. 0 for standard (or unknown), 1 for left, 2 for right, 3 for numpad. * The location of the modifier key. 0 for standard (or unknown), 1 for left, 2 for right, 3 for numpad.
* *
@ -212,6 +223,7 @@ var Key = new Class({
this.altKey = false; this.altKey = false;
this.ctrlKey = false; this.ctrlKey = false;
this.shiftKey = false; this.shiftKey = false;
this.metaKey = false;
this.timeDown = 0; this.timeDown = 0;
this.duration = 0; this.duration = 0;
this.timeUp = 0; this.timeUp = 0;

View file

@ -28,6 +28,7 @@ var ProcessKeyDown = function (key, event)
key.altKey = event.altKey; key.altKey = event.altKey;
key.ctrlKey = event.ctrlKey; key.ctrlKey = event.ctrlKey;
key.shiftKey = event.shiftKey; key.shiftKey = event.shiftKey;
key.metaKey = event.metaKey;
key.location = event.location; key.location = event.location;
if (key.isDown === false) if (key.isDown === false)