UNPKG

medsurf-draw

Version:

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

87 lines 3.91 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 { BaseGenerator, BaseGeneratorModel } from "../../bases/generators/BaseGenerator"; var SelectItemGeneratorModel = (function (_super) { __extends(SelectItemGeneratorModel, _super); function SelectItemGeneratorModel() { return _super !== null && _super.apply(this, arguments) || this; } return SelectItemGeneratorModel; }(BaseGeneratorModel)); export { SelectItemGeneratorModel }; var SelectItemGenerator = (function (_super) { __extends(SelectItemGenerator, _super); function SelectItemGenerator(model) { var _this = _super.call(this, model) || this; _this.target.modeInteraction.setModeItem('choosing'); _this.element.controlChooseItem(); _this.target.parent.on("rightup", _this.chooseInteraction.abortChoose, _this.chooseInteraction); _this.target.parent.on("mouseup", _this.chooseInteraction.endChoose, _this.chooseInteraction); _this.chooseInteraction.on("abortChoose", _this.abortChoose, _this); return _this; } SelectItemGenerator.prototype.start = function (event) { _super.prototype.start.call(this, event); }; SelectItemGenerator.prototype.end = function () { if (this.chooseInteraction) { this.target.parent.off("rightup", this.chooseInteraction.abortChoose, this.chooseInteraction); this.target.parent.off("mouseup", this.chooseInteraction.endChoose, this.chooseInteraction); this.chooseInteraction.removeAllListeners(); } _super.prototype.end.call(this); }; SelectItemGenerator.prototype.destroy = function (options) { this.end(); }; SelectItemGenerator.prototype.endGenerator = function () { _super.prototype.endGenerator.call(this); this.target.sortChildren(); this.target.modeInteraction.setMode(this.target.modeInteraction.defaultMode); }; SelectItemGenerator.prototype.abortGenerator = function () { _super.prototype.abortGenerator.call(this); this.target.getImageObjects() .filter(function (imageObject) { return imageObject.modeInteraction.lastMode.startsWith('choose_new'); }) .forEach(function (imageObject) { imageObject.modeInteraction.setMode("delete_draw"); }); this.target.sortChildren(); this.target.modeInteraction.setMode(this.target.modeInteraction.defaultMode); }; SelectItemGenerator.prototype.abortChoose = function (event) { event.stopPropagation(); this.end(); this.emit("abortGenerator"); }; Object.defineProperty(SelectItemGenerator.prototype, "chooseInteraction", { get: function () { return this.element.chooseInteraction; }, enumerable: false, configurable: true }); Object.defineProperty(SelectItemGenerator.prototype, "element", { get: function () { return this.data.element; }, enumerable: false, configurable: true }); return SelectItemGenerator; }(BaseGenerator)); export { SelectItemGenerator }; //# sourceMappingURL=SelectItemGenerator.js.map