Added literallycanvas and react libraries.
[openemr.git] / library / js / literallycanvas / js / tools / Ellipse.js
blob1bdd17e2fdfd660eef6d46fdebd34750e84a4fd6
1 var Ellipse, ToolWithStroke, createShape,
2   extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
3   hasProp = {}.hasOwnProperty;
5 ToolWithStroke = require('./base').ToolWithStroke;
7 createShape = require('../core/shapes').createShape;
9 module.exports = Ellipse = (function(superClass) {
10   extend(Ellipse, superClass);
12   function Ellipse() {
13     return Ellipse.__super__.constructor.apply(this, arguments);
14   }
16   Ellipse.prototype.name = 'Ellipse';
18   Ellipse.prototype.iconName = 'ellipse';
20   Ellipse.prototype.begin = function(x, y, lc) {
21     return this.currentShape = createShape('Ellipse', {
22       x: x,
23       y: y,
24       strokeWidth: this.strokeWidth,
25       strokeColor: lc.getColor('primary'),
26       fillColor: lc.getColor('secondary')
27     });
28   };
30   Ellipse.prototype["continue"] = function(x, y, lc) {
31     this.currentShape.width = x - this.currentShape.x;
32     this.currentShape.height = y - this.currentShape.y;
33     return lc.drawShapeInProgress(this.currentShape);
34   };
36   Ellipse.prototype.end = function(x, y, lc) {
37     return lc.saveShape(this.currentShape);
38   };
40   return Ellipse;
42 })(ToolWithStroke);