Implement Item#parentToLocal() and #localToParent()

As outlined in #530
This commit is contained in:
Jürg Lehni 2014-09-25 17:53:08 +02:00
parent 3389687c42
commit 762113230a

View file

@ -2980,8 +2980,8 @@ var Item = Base.extend(Callback, /** @lends Item# */{
},
/**
* Converts the specified point from global project coordinates to local
* coordinates in relation to the the item's own coordinate space.
* Converts the specified point from global project coordinate space to the
* item's own local coordinate space.
*
* @param {Point} point the point to be transformed
* @return {Point} the transformed point as a new instance
@ -2992,8 +2992,8 @@ var Item = Base.extend(Callback, /** @lends Item# */{
},
/**
* Converts the specified point from local coordinates to global coordinates
* in relation to the the project coordinate space.
* Converts the specified point from the item's own local coordinate space
* to the global project coordinate space.
*
* @param {Point} point the point to be transformed
* @return {Point} the transformed point as a new instance
@ -3003,6 +3003,28 @@ var Item = Base.extend(Callback, /** @lends Item# */{
Point.read(arguments));
},
/**
* Converts the specified point from the parent's coordinate space to
* item's own local coordinate space.
*
* @param {Point} point the point to be transformed
* @return {Point} the transformed point as a new instance
*/
parentToLocal: function(/* point */) {
return this._matrix._inverseTransform(Point.read(arguments));
},
/**
* Converts the specified point from the item's own local coordinate space
* to the parent's coordinate space.
*
* @param {Point} point the point to be transformed
* @return {Point} the transformed point as a new instance
*/
localToParent: function(/* point */) {
return this._matrix._transformPoint(Point.read(arguments));
},
/**
* Transform the item so that its {@link #bounds} fit within the specified
* rectangle, without changing its aspect ratio.