Write documentation for View#projectToView(), #viewToProject() and #getEventPoint()

This commit is contained in:
Jürg Lehni 2016-01-13 15:31:09 +01:00
parent 5add1bd725
commit dbc5bd175a

View file

@ -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));