UNPKG

medsurf-draw

Version:

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

148 lines 5.36 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 * as PIXI from "pixi.js-legacy"; import * as MedsurfDraw from "../../public-api"; var BaseSpriteModel = (function () { function BaseSpriteModel() { } return BaseSpriteModel; }()); export { BaseSpriteModel }; var BaseSpriteImageModel = (function (_super) { __extends(BaseSpriteImageModel, _super); function BaseSpriteImageModel() { return _super !== null && _super.apply(this, arguments) || this; } return BaseSpriteImageModel; }(BaseSpriteModel)); export { BaseSpriteImageModel }; var BaseSprite = (function (_super) { __extends(BaseSprite, _super); function BaseSprite(data) { var _this = _super.call(this, data.texture) || this; _this.data = data; _this.modeInteraction = new MedsurfDraw.ModeInteraction(_this); _this.modeInteraction.on("init", _this.init, _this); _this.on("added", function (parent) { parent.modeInteraction.on("setDefaultMode", _this.modeInteraction.setDefaultMode, _this.modeInteraction); parent.modeInteraction.on("setMode", _this.modeInteraction.setMode, _this.modeInteraction); }); _this.on("removed", function (parent) { parent.modeInteraction.off("setDefaultMode", _this.modeInteraction.setDefaultMode, _this.modeInteraction); parent.modeInteraction.off("setMode", _this.modeInteraction.setMode, _this.modeInteraction); }); return _this; } BaseSprite.prototype.init = function (parent) { return; }; BaseSprite.prototype.destroy = function (options) { if (this.modeInteraction) { this.modeInteraction.removeAllListeners(); } this.removeAllListeners(); _super.prototype.destroy.call(this, options); }; BaseSprite.prototype.getRectangle = function () { var position = this.position; var bounds = this.getLocalBounds(); return new PIXI.Rectangle(position.x + bounds.x, position.y + bounds.y, bounds.width, bounds.height); }; BaseSprite.prototype.getElementRectangle = function () { return this.getRectangle(); }; BaseSprite.prototype.getRotation = function () { return this.rotation; }; BaseSprite.prototype.showItem = function () { this.visible = true; }; BaseSprite.prototype.hideItem = function () { this.visible = false; }; BaseSprite.prototype.toggleItem = function (override) { this.visible = override || !this.visible; }; BaseSprite.prototype.onImageZoom = function (scaleX, scaleY) { }; Object.defineProperty(BaseSprite.prototype, "data", { get: function () { return this._data; }, set: function (value) { this._data = value; }, enumerable: false, configurable: true }); Object.defineProperty(BaseSprite.prototype, "image", { get: function () { if (this.data.hasOwnProperty("image")) { return this.data.image; } debugger; throw 'Not implemented'; }, enumerable: false, configurable: true }); Object.defineProperty(BaseSprite.prototype, "imageCanvas", { get: function () { if (this.data.hasOwnProperty("image")) { return this.data.image.canvas; } debugger; throw 'Not implemented'; }, enumerable: false, configurable: true }); Object.defineProperty(BaseSprite.prototype, "imageScale", { get: function () { if (this.data.hasOwnProperty("image")) { return this.data.image.imageScale; } debugger; throw 'Not implemented'; }, enumerable: false, configurable: true }); Object.defineProperty(BaseSprite.prototype, "imageDimensions", { get: function () { if (this.data.hasOwnProperty("image")) { return this.data.image.imageDimensions; } debugger; throw 'Not implemented'; }, enumerable: false, configurable: true }); Object.defineProperty(BaseSprite.prototype, "modeInteraction", { get: function () { return this._modeInteraction; }, set: function (value) { this._modeInteraction = value; }, enumerable: false, configurable: true }); return BaseSprite; }(PIXI.Sprite)); export { BaseSprite }; //# sourceMappingURL=BaseSprite.js.map