1 /** 2 * The MIT License (MIT) 3 * 4 * Copyright (c) 2016 DeNA Co., Ltd. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * SOFTWARE. 23 */ 24 25 /// <reference path="base.js"/> 26 /// <reference path="event.js"/> 27 28 /** 29 * A class encapsulating pointer events, i.e. mouse events, pointer events, and 30 * touch events. For a listing of mouse events and their properties, see the 31 * DisplayObject and Stage event listings. 32 * @param {string} type 33 * @param {boolean} bubbles 34 * @param {boolean} cancelable 35 * @param {number} stageX 36 * @param {number} stageY 37 * @param {Object} nativeEvent 38 * @param {number} pointerID 39 * @param {boolean} primary 40 * @param {number} rawX 41 * @param {number} rawY 42 * @extends {createjs.Event} 43 * @constructor 44 */ 45 createjs.MouseEvent = function(type, 46 bubbles, 47 cancelable, 48 stageX, 49 stageY, 50 nativeEvent, 51 pointerID, 52 primary, 53 rawX, 54 rawY) { 55 createjs.Event.call(this, type, bubbles, cancelable); 56 57 /** 58 * The normalized x position on the stage. 59 * @type {number} 60 */ 61 this['stageX'] = stageX; 62 63 /** 64 * The normalized y position on the stage. 65 * @type {number} 66 */ 67 this['stageY'] = stageY; 68 69 /** 70 * The native MouseEvent generated by the browser. The properties and API for 71 * this event may differ between browsers. This property will be null if the 72 * EaselJS property was not directly generated from a native MouseEvent. 73 * @type {Object} 74 */ 75 this['nativeEvent'] = nativeEvent; 76 77 /** 78 * The unique id for the pointer (touch point or cursor). This will be either 79 * -1 for the mouse, or the system supplied id value. 80 * @type {number} 81 */ 82 this['pointerID'] = pointerID; 83 84 /** 85 * Indicates whether this is the primary pointer in a multi-touch environment. 86 * This will always be true for the mouse. For touch pointers, the first 87 * pointer in the current stack will be considered the primary pointer. 88 * @type {boolean} 89 */ 90 this['primary'] = primary; 91 92 /** 93 * The raw x position relative to the stage. 94 * outside of the stage bounds. 95 * @type {number} 96 */ 97 this['rawX'] = rawX; 98 99 /** 100 * The raw y position relative to the stage. 101 * @type {number} 102 */ 103 this['rawY'] = rawY; 104 }; 105 createjs.inherits('MouseEvent', createjs.MouseEvent, createjs.Event); 106 107 /** 108 * Resets this event. 109 * @param {Object} nativeEvent 110 * @param {number} pointerID 111 * @const 112 */ 113 createjs.MouseEvent.prototype.reset = function(nativeEvent, pointerID) { 114 /// <param type="Object" name="nativeEvent"/> 115 /// <param type="number" name="pointerID"/> 116 this['nativeEvent'] = nativeEvent; 117 this['pointerID'] = pointerID; 118 }; 119 120 /** 121 * Sets the 'stageX' value of this object and its 'stageY' value. 122 * @param {number} stageX 123 * @param {number} stageY 124 * @const 125 */ 126 createjs.MouseEvent.prototype.setStage = function(stageX, stageY) { 127 /// <param type="number" name="stageX"/> 128 /// <param type="number" name="stageY"/> 129 this['stageX'] = stageX; 130 this['stageY'] = stageY; 131 }; 132 133 /** 134 * Sets the 'primary' value of this object. 135 * @param {boolean} primary 136 * @const 137 */ 138 createjs.MouseEvent.prototype.setPrimary = function(primary) { 139 /// <param type="boolean" name="primary"/> 140 this['primary'] = primary; 141 }; 142 143 /** 144 * Sets the 'rawX' value of this object and its 'rawY' value. 145 * @param {number} rawX 146 * @param {number} rawY 147 * @const 148 */ 149 createjs.MouseEvent.prototype.setRaw = function(rawX, rawY) { 150 /// <param type="number" name="rawX"/> 151 /// <param type="number" name="rawY"/> 152 this['rawX'] = rawX; 153 this['rawY'] = rawY; 154 }; 155