File tree Expand file tree Collapse file tree 2 files changed +14
-24
lines changed
Expand file tree Collapse file tree 2 files changed +14
-24
lines changed Original file line number Diff line number Diff line change 151151 return p2 . subtractEquals ( p ) ;
152152 } ,
153153
154+ /**
155+ * Returns coordinates of a pointer relative to object's top left corner
156+ * @param {Event } e Event to operate upon
157+ * @param {Object } [pointer] Pointer to operate upon (instead of event)
158+ * @return {Object } Coordinates of a pointer (x, y)
159+ */
160+ getLocalPointer : function ( e , pointer ) {
161+ pointer = pointer || this . canvas . getPointer ( e ) ;
162+ return fabric . util . transformPoint (
163+ new fabric . Point ( pointer . x , pointer . y ) ,
164+ fabric . util . invertTransform ( this . calcTransformMatrix ( ) )
165+ ) . addEquals ( new fabric . Point ( this . width / 2 , this . height / 2 ) ) ;
166+ } ,
167+
154168 /**
155169 * Returns the point in global coordinates
156170 * @param {fabric.Point } The point relative to the local coordinate system
Original file line number Diff line number Diff line change 19251925 return this ;
19261926 } ,
19271927
1928- /**
1929- * Returns coordinates of a pointer relative to an object
1930- * @param {Event } e Event to operate upon
1931- * @param {Object } [pointer] Pointer to operate upon (instead of event)
1932- * @return {Object } Coordinates of a pointer (x, y)
1933- */
1934- getLocalPointer : function ( e , pointer ) {
1935- pointer = pointer || this . canvas . getPointer ( e ) ;
1936- var pClicked = new fabric . Point ( pointer . x , pointer . y ) ,
1937- objectLeftTop = this . _getLeftTopCoords ( ) ,
1938- angle = this . getTotalAngle ( ) ;
1939- if ( this . group ) {
1940- objectLeftTop = fabric . util . transformPoint ( objectLeftTop , this . group . calcTransformMatrix ( ) ) ;
1941- }
1942- if ( this . angle ) {
1943- pClicked = fabric . util . rotatePoint (
1944- pClicked , objectLeftTop , degreesToRadians ( - angle ) ) ;
1945- }
1946- return {
1947- x : pClicked . x - objectLeftTop . x ,
1948- y : pClicked . y - objectLeftTop . y
1949- } ;
1950- } ,
1951-
19521928 /**
19531929 * Sets canvas globalCompositeOperation for specific object
19541930 * custom composition operation for the particular object can be specified using globalCompositeOperation property
You can’t perform that action at this time.
0 commit comments