medsurf-draw
Version:
Draw annotations on jpg/zoomify images, based on PIXI.js
148 lines • 5.57 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 * as MedsurfDraw from "../../public-api";
var BaseTilingSpriteModel = (function () {
function BaseTilingSpriteModel() {
}
return BaseTilingSpriteModel;
}());
export { BaseTilingSpriteModel };
var BaseTilingSpriteImageModel = (function (_super) {
__extends(BaseTilingSpriteImageModel, _super);
function BaseTilingSpriteImageModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
return BaseTilingSpriteImageModel;
}(BaseTilingSpriteModel));
export { BaseTilingSpriteImageModel };
var BaseTilingSprite = (function (_super) {
__extends(BaseTilingSprite, _super);
function BaseTilingSprite(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;
}
BaseTilingSprite.prototype.init = function (parent) {
return;
};
BaseTilingSprite.prototype.destroy = function (options) {
if (this.modeInteraction) {
this.modeInteraction.removeAllListeners();
}
this.removeAllListeners();
_super.prototype.destroy.call(this, options);
};
BaseTilingSprite.prototype.getRectangle = function () {
var position = this.position;
var bounds = this.getLocalBounds(new PIXI.Rectangle());
return new PIXI.Rectangle(position.x + bounds.x, position.y + bounds.y, bounds.width, bounds.height);
};
BaseTilingSprite.prototype.getElementRectangle = function () {
return this.getRectangle();
};
BaseTilingSprite.prototype.getRotation = function () {
return this.rotation;
};
BaseTilingSprite.prototype.showItem = function () {
this.visible = true;
};
BaseTilingSprite.prototype.hideItem = function () {
this.visible = false;
};
BaseTilingSprite.prototype.toggleItem = function (override) {
this.visible = override || !this.visible;
};
BaseTilingSprite.prototype.onImageZoom = function (scaleX, scaleY) {
};
Object.defineProperty(BaseTilingSprite.prototype, "data", {
get: function () {
return this._data;
},
set: function (value) {
this._data = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseTilingSprite.prototype, "image", {
get: function () {
if (this.data.hasOwnProperty("image")) {
return this.data.image;
}
debugger;
throw 'Not implemented';
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseTilingSprite.prototype, "imageCanvas", {
get: function () {
if (this.data.hasOwnProperty("image")) {
return this.data.image.canvas;
}
debugger;
throw 'Not implemented';
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseTilingSprite.prototype, "imageScale", {
get: function () {
if (this.data.hasOwnProperty("image")) {
return this.data.image.imageScale;
}
debugger;
throw 'Not implemented';
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseTilingSprite.prototype, "imageDimensions", {
get: function () {
if (this.data.hasOwnProperty("image")) {
return this.data.image.imageDimensions;
}
debugger;
throw 'Not implemented';
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseTilingSprite.prototype, "modeInteraction", {
get: function () {
return this._modeInteraction;
},
set: function (value) {
this._modeInteraction = value;
},
enumerable: false,
configurable: true
});
return BaseTilingSprite;
}(PIXI.TilingSprite));
export { BaseTilingSprite };
//# sourceMappingURL=BaseTilingSprite.js.map