File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Version NEXT [NOT RELEASED]
99- fixed ColorMatrix.toArray(), .concat(), and .clone()
1010- fixed touch/multitouch in IE11
1111- changed dblclick to use a canvas listener instead of global listener
12+ - added MouseEvent.localX/Y
1213
1314
1415Version 0.7.0 [September 25, 2013]
Original file line number Diff line number Diff line change @@ -168,6 +168,34 @@ var p = MouseEvent.prototype = new createjs.Event();
168168 p . hasEventListener = null ;
169169 p . _listeners = null ;
170170 createjs . EventDispatcher . initialize ( p ) ; // inject EventDispatcher methods.
171+
172+ // getter / setters:
173+ /**
174+ * Returns the x position of the mouse in the local coordinate system of the current target (ie. the dispatcher).
175+ * @property localX
176+ * @type {Number }
177+ * @readonly
178+ */
179+ p . _get_localX = function ( ) {
180+ return this . currentTarget . globalToLocal ( this . rawX , this . rawY ) . x ;
181+ } ;
182+
183+ /**
184+ * Returns the y position of the mouse in the local coordinate system of the current target (ie. the dispatcher).
185+ * @property localY
186+ * @type {Number }
187+ * @readonly
188+ */
189+ p . _get_localY = function ( ) {
190+ return this . currentTarget . globalToLocal ( this . rawX , this . rawY ) . y ;
191+ } ;
192+
193+ try {
194+ Object . defineProperties ( p , {
195+ localX : { get : p . _get_localX } ,
196+ localY : { get : p . _get_localY }
197+ } ) ;
198+ } catch ( e ) { } // TODO: use Log
171199
172200// constructor:
173201 /**
You can’t perform that action at this time.
0 commit comments