1 /**
  2  * Point class.
  3  * 
  4  * @constructor
  5  * @param {Number} [x=0]
  6  * @param {Number} [y=0]
  7  */
  8 mindmaps.Point = function(x, y) {
  9 	this.x = x || 0;
 10 	this.y = y || 0;
 11 };
 12 
 13 /**
 14  * Returns a new point object from generic obj.
 15  * 
 16  * @static
 17  * @param obj
 18  * @returns {mindmaps.Point}
 19  */
 20 mindmaps.Point.fromObject = function(obj) {
 21 	return new mindmaps.Point(obj.x, obj.y);
 22 };
 23 
 24 /**
 25  * Clones a the point.
 26  * 
 27  * @returns {mindmaps.Point}
 28  */
 29 mindmaps.Point.prototype.clone = function() {
 30 	return new mindmaps.Point(this.x, this.y);
 31 };
 32 
 33 /**
 34  * Adds a point to the point.
 35  * @param {mindmaps.Point} point
 36  */
 37 mindmaps.Point.prototype.add = function(point) {
 38 	this.x += point.x;
 39 	this.y += point.y;
 40 };
 41 
 42 /**
 43  * Returns a String representation.
 44  * @returns {String}
 45  */
 46 mindmaps.Point.prototype.toString = function() {
 47 	return "{x: " + this.x + " y: " + this.y + "}";
 48 };