mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Write documentation for View#projectToView(), #viewToProject() and #getEventPoint()
This commit is contained in:
parent
5add1bd725
commit
dbc5bd175a
1 changed files with 16 additions and 7 deletions
|
@ -481,26 +481,35 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
// TODO: getMousePoint
|
// TODO: getMousePoint
|
||||||
// TODO: projectToView(rect)
|
// TODO: projectToView(rect)
|
||||||
|
|
||||||
// DOCS: projectToView(point), viewToProject(point)
|
|
||||||
/**
|
/**
|
||||||
* @param {Point} point
|
* Converts the passed point from project coordinate space to view
|
||||||
* @return {Point}
|
* coordinate space, which is measured in browser pixels in relation to the
|
||||||
|
* position of the view element.
|
||||||
|
*
|
||||||
|
* @param {Point} point the point in project coordinates to be converted
|
||||||
|
* @return {Point} the point converted into view coordinates
|
||||||
*/
|
*/
|
||||||
projectToView: function(/* point */) {
|
projectToView: function(/* point */) {
|
||||||
return this._matrix._transformPoint(Point.read(arguments));
|
return this._matrix._transformPoint(Point.read(arguments));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Point} point
|
* Converts the passed point from view coordinate space to project
|
||||||
* @return {Point}
|
* coordinate space.
|
||||||
|
*
|
||||||
|
* @param {Point} point the point in view coordinates to be converted
|
||||||
|
* @return {Point} the point converted into project coordinates
|
||||||
*/
|
*/
|
||||||
viewToProject: function(/* point */) {
|
viewToProject: function(/* point */) {
|
||||||
return this._matrix._inverseTransform(Point.read(arguments));
|
return this._matrix._inverseTransform(Point.read(arguments));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Event} event
|
* Determines and returns the event location in project coordinate space.
|
||||||
* @return {Point}
|
*
|
||||||
|
* @param {Event} event the native event object for which to determine the
|
||||||
|
* location.
|
||||||
|
* @return {Point} the event point in project coordinates.
|
||||||
*/
|
*/
|
||||||
getEventPoint: function(event) {
|
getEventPoint: function(event) {
|
||||||
return this.viewToProject(DomEvent.getOffset(event, this._element));
|
return this.viewToProject(DomEvent.getOffset(event, this._element));
|
||||||
|
|
Loading…
Reference in a new issue