medsurf-draw
Version:
Draw annotations on jpg/zoomify images, based on PIXI.js
98 lines • 3.84 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 __());
};
})();
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import { BaseElementInteraction } from "../bases/interactions/BaseElementInteraction";
var ModeInteraction = (function (_super) {
__extends(ModeInteraction, _super);
function ModeInteraction(element, defaultMode) {
if (defaultMode === void 0) { defaultMode = "init"; }
var _this = _super.call(this, element) || this;
_this.defaultMode = defaultMode;
_this.element.on("added", function (parentImageObject) {
_this._parentImageObject = parentImageObject;
_this._lastMode = _this.defaultMode;
_this.emit(_this.defaultMode, _this._parentImageObject, _this.lastMode);
});
return _this;
}
ModeInteraction.prototype.reset = function () {
return;
};
ModeInteraction.prototype.setDefaultMode = function (mode) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
this.defaultMode = mode;
this._changeMode(mode);
this.emit("setDefaultMode", mode);
};
ModeInteraction.prototype.setMode = function (mode) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
this._changeMode(mode);
this.emit("setMode", mode);
};
ModeInteraction.prototype.setModeChildren = function (mode) {
this.emit("setMode", mode);
};
ModeInteraction.prototype.setModeItem = function (mode) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
this._changeMode(mode);
};
ModeInteraction.prototype._changeMode = function (mode) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
this.emit("remove-" + this.lastMode, this._parentImageObject, mode);
this._lastMode = mode;
this.emit.apply(this, __spreadArray([mode, this._parentImageObject, mode], args, false));
};
Object.defineProperty(ModeInteraction.prototype, "defaultMode", {
get: function () {
return this._defaultMode;
},
set: function (value) {
this._defaultMode = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ModeInteraction.prototype, "lastMode", {
get: function () {
return this._lastMode;
},
enumerable: false,
configurable: true
});
return ModeInteraction;
}(BaseElementInteraction));
export { ModeInteraction };
//# sourceMappingURL=ModeInteraction.js.map