UNPKG

konva

Version:

<p align="center"> <img src="https://raw.githubusercontent.com/konvajs/konvajs.github.io/master/apple-touch-icon-180x180.png" alt="Konva logo" height="180" /> </p>

62 lines (61 loc) 2.31 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var Util_1 = require("../Util"); var Factory_1 = require("../Factory"); var Shape_1 = require("../Shape"); var Global_1 = require("../Global"); var Validators_1 = require("../Validators"); var Global_2 = require("../Global"); var Wedge = (function (_super) { __extends(Wedge, _super); function Wedge() { return _super !== null && _super.apply(this, arguments) || this; } Wedge.prototype._sceneFunc = function (context) { context.beginPath(); context.arc(0, 0, this.radius(), 0, Global_1.Konva.getAngle(this.angle()), this.clockwise()); context.lineTo(0, 0); context.closePath(); context.fillStrokeShape(this); }; Wedge.prototype.getWidth = function () { return this.radius() * 2; }; Wedge.prototype.getHeight = function () { return this.radius() * 2; }; Wedge.prototype.setWidth = function (width) { this.radius(width / 2); }; Wedge.prototype.setHeight = function (height) { this.radius(height / 2); }; return Wedge; }(Shape_1.Shape)); exports.Wedge = Wedge; Wedge.prototype.className = 'Wedge'; Wedge.prototype._centroid = true; Wedge.prototype._attrsAffectingSize = ['radius']; Global_2._registerNode(Wedge); Factory_1.Factory.addGetterSetter(Wedge, 'radius', 0, Validators_1.getNumberValidator()); Factory_1.Factory.addGetterSetter(Wedge, 'angle', 0, Validators_1.getNumberValidator()); Factory_1.Factory.addGetterSetter(Wedge, 'clockwise', false); Factory_1.Factory.backCompat(Wedge, { angleDeg: 'angle', getAngleDeg: 'getAngle', setAngleDeg: 'setAngle' }); Util_1.Collection.mapMethods(Wedge);