medsurf-draw
Version:
Draw annotations on jpg/zoomify images, based on PIXI.js
84 lines • 3.02 kB
JavaScript
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, BaseGraphicsModel } from "../../bases/elements/BaseGraphics";
var RectangleModel = (function (_super) {
__extends(RectangleModel, _super);
function RectangleModel() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.options = { hasLine: true, lineColor: 0xFFFFFF, lineAlpha: 1, hasFill: false };
_this.lineWidth = 1;
return _this;
}
return RectangleModel;
}(BaseGraphicsModel));
export { RectangleModel };
var Rectangle = (function (_super) {
__extends(Rectangle, _super);
function Rectangle(model) {
return _super.call(this, model) || this;
}
Rectangle.prototype.init = function () {
this.sortChildren();
this.emit("debounceDraw");
};
Rectangle.prototype.draw = function () {
if (!this._geometry) {
return;
}
this.clear();
if (this.options.hasLine) {
this.lineStyle(this.lineWidth || 0, this.options.lineColor, this.options.lineAlpha, 1);
}
if (this.options.hasFill) {
this.beginFill(this.options.fillColor, this.options.fillAlpha);
}
this.drawRect(this.rectangle.x, this.rectangle.y, this.rectangle.width, this.rectangle.height);
this.endFill();
};
Object.defineProperty(Rectangle.prototype, "rectangle", {
get: function () {
return this.data.rectangle;
},
set: function (value) {
this.data.rectangle = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Rectangle.prototype, "options", {
get: function () {
return this.data.options;
},
set: function (value) {
this.data.options = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Rectangle.prototype, "lineWidth", {
get: function () {
return this.data.lineWidth;
},
set: function (value) {
this.data.lineWidth = value;
},
enumerable: false,
configurable: true
});
return Rectangle;
}(BaseGraphics));
export { Rectangle };
//# sourceMappingURL=Rectangle.js.map