UNPKG

starling-framework

Version:

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

74 lines (58 loc) 1.92 kB
// Class: starling.events.TouchData 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; function openfl__$Vector_Vector_$Impl_$() {return require("./../../openfl/_Vector/Vector_Impl_");} // Constructor var TouchData = function() { } // Meta TouchData.__name__ = "starling.events.TouchData"; TouchData.__isInterface__ = false; TouchData.prototype = { setTo: function(touchID,phase,globalX,globalY,pressure,width,height) { if(height == null) { height = 1.0; } if(width == null) { width = 1.0; } if(pressure == null) { pressure = 1.0; } this.id = touchID; this.phase = phase; this.globalX = globalX; this.globalY = globalY; this.pressure = pressure; this.width = width; this.height = height; } }; TouchData.prototype.__class__ = TouchData.prototype.constructor = $hxClasses["starling.events.TouchData"] = TouchData; // Init // Statics TouchData.fromPool = function(touchID,phase,globalX,globalY,pressure,width,height) { if(height == null) { height = 1.0; } if(width == null) { width = 1.0; } if(pressure == null) { pressure = 1.0; } var touchData = TouchData.sPool.length > 0 ? (openfl__$Vector_Vector_$Impl_$().default).pop(TouchData.sPool) : new TouchData(); touchData.setTo(touchID,phase,globalX,globalY,pressure,width,height); return touchData; } TouchData.toPool = function(rawTouch) { (openfl__$Vector_Vector_$Impl_$().default).set(TouchData.sPool,TouchData.sPool.length,rawTouch); } TouchData.sPool = (openfl__$Vector_Vector_$Impl_$().default)._new() // Export exports.default = TouchData;