medsurf-draw
Version:
Draw annotations on jpg/zoomify images, based on PIXI.js
82 lines • 4.38 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 * as PIXI from "pixi.js-legacy";
import { BaseContainer, BaseContainerModel } from "../../bases/elements/BaseContainer";
import { Design } from "../../config/design";
var KillboxModel = (function (_super) {
__extends(KillboxModel, _super);
function KillboxModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
return KillboxModel;
}(BaseContainerModel));
export { KillboxModel };
var Killbox = (function (_super) {
__extends(Killbox, _super);
function Killbox(model) {
var _this = _super.call(this, model) || this;
_this.zIndex = Design.selftestElement.zIndex;
return _this;
}
Killbox.prototype.init = function () {
this.interactive = true;
this.position.set(this.rectangle.x, this.rectangle.y);
this._killboxElement = new PIXI.Graphics();
this.addChild(this._killboxElement);
};
Killbox.prototype.draw = function () {
this.cacheAsBitmap = false;
this._killboxElement.clear();
this._killboxElement.lineStyle(Design.selftestElement.lineWidth, Design.selftestElement.lineColor, Design.selftestElement.lineAlpha);
this._killboxElement.moveTo(this.rectangle.x, this.rectangle.y);
this._killboxElement.lineTo(this.rectangle.x + Design.selftestElement.gab, this.rectangle.y);
this._killboxElement.moveTo(this.rectangle.x, this.rectangle.y);
this._killboxElement.lineTo(this.rectangle.x, this.rectangle.y + Design.selftestElement.gab);
this._killboxElement.moveTo(this.rectangle.x + this.rectangle.width, this.rectangle.y);
this._killboxElement.lineTo(this.rectangle.x + this.rectangle.width - Design.selftestElement.gab, this.rectangle.y);
this._killboxElement.moveTo(this.rectangle.x + this.rectangle.width, this.rectangle.y);
this._killboxElement.lineTo(this.rectangle.x + this.rectangle.width, this.rectangle.y + Design.selftestElement.gab);
this._killboxElement.moveTo(this.rectangle.x, this.rectangle.y + this.rectangle.height);
this._killboxElement.lineTo(this.rectangle.x + Design.selftestElement.gab, this.rectangle.y + this.rectangle.height);
this._killboxElement.moveTo(this.rectangle.x, this.rectangle.y + this.rectangle.height);
this._killboxElement.lineTo(this.rectangle.x, this.rectangle.y + this.rectangle.height - Design.selftestElement.gab);
this._killboxElement.moveTo(this.rectangle.x + this.rectangle.width, this.rectangle.y + this.rectangle.height);
this._killboxElement.lineTo(this.rectangle.x + this.rectangle.width - Design.selftestElement.gab, this.rectangle.y + this.rectangle.height);
this._killboxElement.moveTo(this.rectangle.x + this.rectangle.width, this.rectangle.y + this.rectangle.height);
this._killboxElement.lineTo(this.rectangle.x + this.rectangle.width, this.rectangle.y + this.rectangle.height - Design.selftestElement.gab);
this._killboxElement.endFill();
this.cacheAsBitmap = true;
};
Killbox.prototype.destroy = function (options) {
if (this._killboxElement) {
this._killboxElement.destroy(options);
}
_super.prototype.destroy.call(this, options);
};
Object.defineProperty(Killbox.prototype, "rectangle", {
get: function () {
return this.data.rectangle;
},
set: function (value) {
this.data.rectangle = value;
},
enumerable: false,
configurable: true
});
return Killbox;
}(BaseContainer));
export { Killbox };
//# sourceMappingURL=Killbox.js.map