mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Add Point#clone docs to Point.js.
This commit is contained in:
parent
ebbf8cf039
commit
95f9028091
1 changed files with 15 additions and 0 deletions
|
@ -33,6 +33,21 @@ var Point = Base.extend({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a copy of the point.
|
||||
* This is useful as the following code only generates a flat copy:
|
||||
*
|
||||
* <code>
|
||||
* var point1 = new Point();
|
||||
* var point2 = point1;
|
||||
* point2.x = 1; // also changes point1.x
|
||||
*
|
||||
* var point2 = point1.clone();
|
||||
* point2.x = 1; // doesn't change point1.x
|
||||
* </code>
|
||||
*
|
||||
* @return the cloned point
|
||||
*/
|
||||
clone: function() {
|
||||
return Point.create(this.x, this.y);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue