1 /** 2 * The Render Engine 3 * MouseInfo 4 * 5 * @fileoverview Data object which holds mouse information. 6 * 7 * @author: Brett Fattori (brettf@renderengine.com) 8 * 9 * @author: $Author: bfattori $ 10 * @version: $Revision: 1555 $ 11 * 12 * Copyright (c) 2011 Brett Fattori (brettf@renderengine.com) 13 * 14 * Permission is hereby granted, free of charge, to any person obtaining a copy 15 * of this software and associated documentation files (the "Software"), to deal 16 * in the Software without restriction, including without limitation the rights 17 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 * copies of the Software, and to permit persons to whom the Software is 19 * furnished to do so, subject to the following conditions: 20 * 21 * The above copyright notice and this permission notice shall be included in 22 * all copies or substantial portions of the Software. 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 * THE SOFTWARE. 31 * 32 */ 33 34 // The class this file defines and its required classes 35 R.Engine.define({ 36 "class":"R.struct.TouchInfo", 37 "requires":[ 38 "R.struct.MouseInfo", 39 "R.struct.Touch" 40 ] 41 }); 42 43 /** 44 * @class An object which contains information about touch gestures in relation to 45 * a rendering context. 46 * 47 * @extends R.struct.MouseInfo 48 * @constructor 49 * @description Creates a touch data structure. 50 */ 51 R.struct.TouchInfo = function () { 52 return R.struct.MouseInfo.extend(/** @scope R.struct.TouchInfo.prototype */{ 53 54 /** 55 * All touches. See {@link R.struct.Touch} for more info. 56 * @type {Array} 57 */ 58 touches:null, 59 60 /** @private */ 61 constructor:function () { 62 this.touches = []; 63 this.base("TouchInfo"); 64 }, 65 66 /** 67 * Release the collision data object back into the pool for reuse. 68 */ 69 release:function () { 70 this.base(); 71 this.touches = null; 72 } 73 74 }, { 75 getClassName:function () { 76 return "R.struct.TouchInfo"; 77 }, 78 79 /** 80 * Process the touches and pass an array of touch objects to be handled by the 81 * host object. 82 * @private 83 */ 84 processTouches:function (eventObj) { 85 var touches = []; 86 if (eventObj.touches) { 87 for (var i = 0; i < eventObj.touches.length; i++) { 88 touches.push(new R.struct.Touch(eventObj.touches[i])); 89 } 90 } 91 return touches; 92 } 93 94 }); 95 }; 96 97