UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

92 lines (76 loc) 2.67 kB
// Class: starling.events.KeyboardEvent var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this $global.Object.defineProperty(exports, "__esModule", {value: true}); var __map_reserved = {}; // Imports var $hxClasses = require("./../../hxClasses_stub").default; var $hxEnums = require("./../../hxEnums_stub").default; var $import = require("./../../import_stub").default; var $extend = require("./../../extend_stub").default; function starling_events_Event() {return require("./../../starling/events/Event");} // Constructor var KeyboardEvent = function(type,charCode,keyCode,keyLocation,ctrlKey,altKey,shiftKey) { if(shiftKey == null) { shiftKey = false; } if(altKey == null) { altKey = false; } if(ctrlKey == null) { ctrlKey = false; } if(keyLocation == null) { keyLocation = 0; } if(keyCode == null) { keyCode = 0; } if(charCode == null) { charCode = 0; } (starling_events_Event().default).call(this,type,false,keyCode); this.__charCode = charCode; this.__keyCode = keyCode; this.__keyLocation = keyLocation; this.__ctrlKey = ctrlKey; this.__altKey = altKey; this.__shiftKey = shiftKey; } // Meta KeyboardEvent.__name__ = "starling.events.KeyboardEvent"; KeyboardEvent.__isInterface__ = false; KeyboardEvent.__super__ = (starling_events_Event().default); KeyboardEvent.prototype = $extend((starling_events_Event().default).prototype, { preventDefault: function() { this.__isDefaultPrevented = true; }, isDefaultPrevented: function() { return this.__isDefaultPrevented; }, get_charCode: function() { return this.__charCode; }, get_keyCode: function() { return this.__keyCode; }, get_keyLocation: function() { return this.__keyLocation; }, get_altKey: function() { return this.__altKey; }, get_ctrlKey: function() { return this.__ctrlKey; }, get_shiftKey: function() { return this.__shiftKey; } }); KeyboardEvent.prototype.__class__ = KeyboardEvent.prototype.constructor = $hxClasses["starling.events.KeyboardEvent"] = KeyboardEvent; // Init Object.defineProperties(KeyboardEvent.prototype,{ charCode : { get : function () { return this.get_charCode (); }}, keyCode : { get : function () { return this.get_keyCode (); }}, keyLocation : { get : function () { return this.get_keyLocation (); }}, altKey : { get : function () { return this.get_altKey (); }}, ctrlKey : { get : function () { return this.get_ctrlKey (); }}, shiftKey : { get : function () { return this.get_shiftKey (); }}}); // Statics KeyboardEvent.KEY_UP = "keyUp" KeyboardEvent.KEY_DOWN = "keyDown" // Export exports.default = KeyboardEvent;