'use strict';
const Rac = require('../Rac');
const utils = require('../util/utils');
module.exports = function attachPointFunctions(rac) {
/**
* Calls `p5.vertex` as to represent this `Point`.
*
* Added when `Rac.P5Drawer` is setup as `rac.drawer`.
*/
Rac.Point.prototype.vertex = function() {
this.rac.drawer.p5.vertex(this.x, this.y);
};
/**
* Returns a `Point` at the current position of the pointer.
*
* Added when `Rac.P5Drawer` is setup as `rac.drawer`.
*
* @function pointer
* @memberof rac.Point#
*/
rac.Point.pointer = function() {
return rac.Point(rac.drawer.p5.mouseX, rac.drawer.p5.mouseY);
};
/**
* Returns a `Point` at the center of the canvas.
*
* Added when `Rac.P5Drawer` is setup as `rac.drawer`.
*
* @function canvasCenter
* @memberof rac.Point#
*/
rac.Point.canvasCenter = function() {
return rac.Point(rac.drawer.p5.width/2, rac.drawer.p5.height/2);
};
/**
* Returns a `Point` at the end of the canvas, that is, at the position
* `(width,height)`.
*
* Added when `Rac.P5Drawer` is setup as `rac.drawer`.
*
* @function canvasEnd
* @memberof rac.Point#
*/
rac.Point.canvasEnd = function() {
return rac.Point(rac.drawer.p5.width, rac.drawer.p5.height);
};
} // attachPointFunctions