UNPKG

medsurf-draw

Version:

Draw annotations on jpg/zoomify images, based on PIXI.js

111 lines 4.79 kB
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { BaseGraphics, BaseGraphicsImageModel } from "../../bases/elements/BaseGraphics"; import { BezierLinePointsModel, QuadraticCurvePointsModel } from "../../public-api"; var LineControlPointModel = (function (_super) { __extends(LineControlPointModel, _super); function LineControlPointModel() { return _super !== null && _super.apply(this, arguments) || this; } return LineControlPointModel; }(BaseGraphicsImageModel)); export { LineControlPointModel }; var LineControlPoint = (function (_super) { __extends(LineControlPoint, _super); function LineControlPoint(model) { return _super.call(this, model) || this; } LineControlPoint.prototype.init = function () { this.sortChildren(); this.emit("debounceDraw"); }; LineControlPoint.prototype.draw = function () { if (!this._geometry) { return; } this.cacheAsBitmap = false; this.clear(); if (!(this.points instanceof QuadraticCurvePointsModel || this.points instanceof BezierLinePointsModel)) { return; } this.beginFill(this.options.fillColor, this.options.fillAlpha); this.drawCircle(this.points.controlPointsPrevious.c1.x, this.points.controlPointsPrevious.c1.y, this.radius); this.drawCircle(this.points.controlPointsPrevious.c2.x, this.points.controlPointsPrevious.c2.y, this.radius); this.endFill(); this.lineStyle(this.lineWidth, this.options.lineColor, this.options.lineAlpha); this.moveTo(this.points.controlPointsPrevious.c1.x, this.points.controlPointsPrevious.c1.y); this.lineTo(this.points.start.x, this.points.start.y); this.moveTo(this.points.controlPointsPrevious.c2.x, this.points.controlPointsPrevious.c2.y); this.lineTo(this.points.start.x, this.points.start.y); this.endFill(); if (this.points instanceof BezierLinePointsModel) { this.beginFill(this.options.fillColor, this.options.fillAlpha); this.drawCircle(this.points.controlPointsNext.c1.x, this.points.controlPointsNext.c1.y, this.radius); this.drawCircle(this.points.controlPointsNext.c2.x, this.points.controlPointsNext.c2.y, this.radius); this.endFill(); this.lineStyle(this.lineWidth, this.options.lineColor, this.options.lineAlpha); this.moveTo(this.points.controlPointsNext.c1.x, this.points.controlPointsNext.c1.y); this.lineTo(this.points.end.x, this.points.end.y); this.moveTo(this.points.controlPointsNext.c2.x, this.points.controlPointsNext.c2.y); this.lineTo(this.points.end.x, this.points.end.y); this.endFill(); } this.cacheAsBitmap = true; }; Object.defineProperty(LineControlPoint.prototype, "points", { get: function () { return this.data.points; }, set: function (value) { this.data.points = value; }, enumerable: false, configurable: true }); Object.defineProperty(LineControlPoint.prototype, "options", { get: function () { return this.data.options; }, set: function (value) { this.data.options = value; }, enumerable: false, configurable: true }); Object.defineProperty(LineControlPoint.prototype, "lineWidth", { get: function () { return this.data.lineWidth; }, set: function (value) { this.data.lineWidth = value; }, enumerable: false, configurable: true }); Object.defineProperty(LineControlPoint.prototype, "radius", { get: function () { return this.data.radius; }, set: function (value) { this.data.radius = value; }, enumerable: false, configurable: true }); return LineControlPoint; }(BaseGraphics)); export { LineControlPoint }; //# sourceMappingURL=LineControlPoint.js.map