medsurf-draw
Version:
Draw annotations on jpg/zoomify images, based on PIXI.js
75 lines • 2.97 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 { debounce } from 'debounce';
var BaseGeneratorModel = (function () {
function BaseGeneratorModel() {
}
return BaseGeneratorModel;
}());
export { BaseGeneratorModel };
var BaseGenerator = (function (_super) {
__extends(BaseGenerator, _super);
function BaseGenerator(data) {
var _this = _super.call(this) || this;
_this.data = data;
_this._debounceStartMethod = debounce(_this.start.bind(_this), 50).bind(_this);
_this._debounceEndMethod = debounce(_this.end.bind(_this), 200).bind(_this);
_this.target.parent.once("setDefaultMode", _this.destroy, _this);
_this.on("debounceStart", _this._debounceStartMethod);
_this.on("debounceEnd", _this._debounceEndMethod);
return _this;
}
BaseGenerator.prototype.start = function (event) {
this.emit("startGenerator", event);
};
BaseGenerator.prototype.end = function () {
this.target.parent.off("setDefaultMode", this.destroy, this);
this.off("debounceStart", this._debounceStartMethod);
this.off("debounceEnd", this._debounceEndMethod);
};
BaseGenerator.prototype.endGenerator = function () {
this.off('endGenerator', this.endGenerator, this);
this.off('abortGenerator', this.abortGenerator, this);
};
BaseGenerator.prototype.abortGenerator = function () {
this.off('endGenerator', this.endGenerator, this);
this.off('abortGenerator', this.abortGenerator, this);
};
Object.defineProperty(BaseGenerator.prototype, "data", {
get: function () {
return this._data;
},
set: function (value) {
this._data = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseGenerator.prototype, "target", {
get: function () {
return this.data.target;
},
set: function (value) {
this.data.target = value;
},
enumerable: false,
configurable: true
});
return BaseGenerator;
}(PIXI.utils.EventEmitter));
export { BaseGenerator };
//# sourceMappingURL=BaseGenerator.js.map