medsurf-draw
Version:
Draw annotations on jpg/zoomify images, based on PIXI.js
85 lines • 3.83 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 { Design } from "../../config/design";
import { BaseGraphics, BaseGraphicsImageModel } from "../../bases/elements/BaseGraphics";
var IndexedRoundButtonMaskElementModel = (function (_super) {
__extends(IndexedRoundButtonMaskElementModel, _super);
function IndexedRoundButtonMaskElementModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
return IndexedRoundButtonMaskElementModel;
}(BaseGraphicsImageModel));
export { IndexedRoundButtonMaskElementModel };
var IndexedRoundButtonMaskElement = (function (_super) {
__extends(IndexedRoundButtonMaskElement, _super);
function IndexedRoundButtonMaskElement(model) {
return _super.call(this, model) || this;
}
IndexedRoundButtonMaskElement.prototype.init = function (parent) {
this.sortChildren();
this.emit("debounceDraw");
};
IndexedRoundButtonMaskElement.prototype.draw = function () {
if (!this._geometry) {
return;
}
this.cacheAsBitmap = false;
this.clear();
this.beginFill(0xFFFFFF, 1);
this.drawPolygon([
new PIXI.Point(this.textRectangle.x, this.textRectangle.y),
new PIXI.Point(this.textRectangle.x + this.textRectangle.width, this.textRectangle.y),
new PIXI.Point(this.textRectangle.x + this.textRectangle.width, this.indexRectangle.y - Design.indexedRoundButtonMask.pad),
new PIXI.Point(this.indexRectangle.x - Design.indexedRoundButtonMask.pad, this.indexRectangle.y - Design.indexedRoundButtonMask.pad),
new PIXI.Point(this.indexRectangle.x - Design.indexedRoundButtonMask.pad, this.textRectangle.y + this.textRectangle.height),
new PIXI.Point(this.textRectangle.x, this.textRectangle.y + this.textRectangle.height),
]);
this.endFill();
this.cacheAsBitmap = true;
};
IndexedRoundButtonMaskElement.prototype.destroy = function (options) {
_super.prototype.destroy.call(this, options);
};
IndexedRoundButtonMaskElement.prototype.onImageZoom = function (scaleX, scaleY) {
this.emit("debounceDraw");
};
Object.defineProperty(IndexedRoundButtonMaskElement.prototype, "textRectangle", {
get: function () {
return this.data.textRectangle;
},
set: function (value) {
this.data.textRectangle = value;
this.emit("debounceDraw");
},
enumerable: false,
configurable: true
});
Object.defineProperty(IndexedRoundButtonMaskElement.prototype, "indexRectangle", {
get: function () {
return this.data.indexRectangle;
},
set: function (value) {
this.data.indexRectangle = value;
this.emit("debounceDraw");
},
enumerable: false,
configurable: true
});
return IndexedRoundButtonMaskElement;
}(BaseGraphics));
export { IndexedRoundButtonMaskElement };
//# sourceMappingURL=IndexedRoundButtonMaskElement.js.map