medsurf-draw
Version:
Draw annotations on jpg/zoomify images, based on PIXI.js
650 lines • 30.8 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";
import * as Models from '@ascii-dev-user/medsurf-lib/models';
import { v4 as uuidv4 } from 'uuid';
import { BaseGenerator, BaseGeneratorModel } from "../../bases/generators/BaseGenerator";
var CopyImageObjectMapping = (function () {
function CopyImageObjectMapping() {
}
return CopyImageObjectMapping;
}());
export { CopyImageObjectMapping };
var CloneItemGeneratorModel = (function (_super) {
__extends(CloneItemGeneratorModel, _super);
function CloneItemGeneratorModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
return CloneItemGeneratorModel;
}(BaseGeneratorModel));
export { CloneItemGeneratorModel };
var CloneItemGenerator = (function (_super) {
__extends(CloneItemGenerator, _super);
function CloneItemGenerator(model) {
var _this = _super.call(this, model) || this;
if (!_this.data.imageObjectMappings) {
_this.data.imageObjectMappings = [];
}
_this._cloneInteraction = new MedsurfDraw.CloneInteraction();
_this.target.modeInteraction.setModeItem("cloning");
var data = _this.getCloneElement(_this.data.element, _this.data.relativePoint);
_this.data.relativePoint = data.relativePoint;
_this._cloneElement = data.element;
_this.cloneElement.controlCloneItem();
_this.target.on('imageZoom', _this.onZoom, _this);
_this.target.parent.on("mousedown", _this.cloneInteraction.startClone, _this.cloneInteraction);
_this.target.parent.on("rightup", _this.cloneInteraction.abortClone, _this.cloneInteraction);
_this.target.parent.on("pointermove", _this.cloneInteraction.onClone, _this.cloneInteraction);
_this.target.parent.on("mouseup", _this.cloneInteraction.endClone, _this.cloneInteraction);
_this.cloneInteraction.on("endClone", _this.endClone, _this);
_this.cloneInteraction.on("abortClone", _this.abortClone, _this);
var globalPoint = _this.target.renderer.plugins.interaction.mouse.global;
var hitTest = _this.target.renderer.plugins.interaction.hitTest(globalPoint, _this.target.parent);
if (!hitTest) {
_this.target.parent.once("pointerover", _this.start, _this);
}
else {
var event_1 = new PIXI.InteractionEvent();
event_1.data = new PIXI.InteractionData();
event_1.data.global = globalPoint;
_this.emit("debounceStart", event_1);
}
return _this;
}
CloneItemGenerator.prototype.start = function (event) {
this.onZoom();
this.cloneInteraction.startClone(event);
_super.prototype.start.call(this, event);
this.onZoom();
};
CloneItemGenerator.prototype.end = function () {
this.target.off('imageZoom', this.onZoom, this);
this.target.parent.off("mousedown", this.cloneInteraction.startClone, this.cloneInteraction);
this.target.parent.off("rightup", this.cloneInteraction.abortClone, this.cloneInteraction);
this.target.parent.off("pointermove", this.cloneInteraction.onClone, this.cloneInteraction);
this.target.parent.off("mouseup", this.cloneInteraction.endClone, this.cloneInteraction);
this.cloneInteraction.removeAllListeners();
this.removeAllListeners("onZoom");
_super.prototype.end.call(this);
};
CloneItemGenerator.prototype.destroy = function (options) {
this.end();
};
CloneItemGenerator.prototype.endGenerator = function () {
_super.prototype.endGenerator.call(this);
this.target.sortChildren();
this.target.modeInteraction.setMode(this.target.modeInteraction.defaultMode);
};
CloneItemGenerator.prototype.abortGenerator = function () {
_super.prototype.abortGenerator.call(this);
var imageObjects = this.target.getImageObjects();
imageObjects.filter(function (imageObject) { return imageObject.modeInteraction.lastMode.startsWith('clone')
&& imageObject.modeInteraction.lastMode.endsWith('new'); })
.sort(function (a, b) {
var aModel = a.model;
var bModel = b.model;
if (aModel.type === Models.ImageObjectType.LINE) {
if (bModel.type === Models.ImageObjectType.LINE) {
return 0;
}
else {
return -1;
}
}
else {
if (bModel.type === Models.ImageObjectType.LINE) {
return 1;
}
}
return 0;
}).forEach(function (imageObject) {
imageObject.modeInteraction.setMode("delete_clone");
});
this.target.sortChildren();
this.target.modeInteraction.setMode(this.target.modeInteraction.defaultMode);
};
CloneItemGenerator.prototype.getCloneElement = function (model, relativePoint) {
if (relativePoint === void 0) { relativePoint = undefined; }
switch (model.type) {
case Models.ImageObjectType.POSITIONPOINT:
return this.clonePositionPoint(model, relativePoint);
case Models.ImageObjectType.LINE:
return this.cloneLine(model, relativePoint);
case Models.ImageObjectType.FILLCOLLECTION:
return this.cloneFillCollection(model, relativePoint);
case Models.ImageObjectType.LEGENDCOLLECTION:
return this.cloneLegendCollection(model, relativePoint);
default:
throw "Not implemented";
}
throw "Not implemented";
};
CloneItemGenerator.prototype.clonePositionPoint = function (model, relativePoint) {
if (relativePoint === void 0) { relativePoint = undefined; }
if (!relativePoint) {
relativePoint = model.position;
}
var positionPoint;
var positionPointMapping = this.data.imageObjectMappings.find(function (mapping) { return mapping.old.id === model.id; });
if (positionPointMapping) {
positionPoint = this.target.getImageObjects().find(function (imageObject) { return imageObject.name === positionPointMapping.new.id; });
}
else {
positionPoint = this.createPositionPointInstance(model, relativePoint);
}
return { element: positionPoint, relativePoint: relativePoint };
};
CloneItemGenerator.prototype.cloneLine = function (model, relativePoint) {
if (relativePoint === void 0) { relativePoint = undefined; }
var imageObjects = this.target.getImageObjects();
var line;
var lineMapping = this.data.imageObjectMappings.find(function (mapping) { return mapping.old.id === model.id; });
if (lineMapping) {
line = imageObjects.find(function (imageObject) { return imageObject.name === lineMapping.new.id; });
var start = imageObjects.find(function (imageObject) { return imageObject.name === model.start; });
if (start instanceof MedsurfDraw.PositionPoint) {
if (!relativePoint) {
relativePoint = start.model.position;
}
}
}
else {
var start = void 0;
var startMapping_1 = this.data.imageObjectMappings.find(function (mapping) { return mapping.old.id === model.start; });
if (startMapping_1) {
start = imageObjects.find(function (imageObject) { return imageObject.name === startMapping_1.new.id; });
}
else {
var startModel = this.data.imageObjects.find(function (imageObject) { return imageObject.id === model.start; });
if (startModel.type === Models.ImageObjectType.POSITIONPOINT) {
var data = this.clonePositionPoint(startModel, relativePoint);
start = data.element;
relativePoint = data.relativePoint;
start.modeInteraction.setMode('clone_item_new');
}
else {
throw 'Fill collection not implemented';
}
}
var end = void 0;
var endMapping_1 = this.data.imageObjectMappings.find(function (mapping) { return mapping.old.id === model.end; });
if (endMapping_1) {
end = imageObjects.find(function (imageObjects) { return imageObjects.name === endMapping_1.new.id; });
}
else {
var endModel = this.data.imageObjects.find(function (imageObject) { return imageObject.id === model.end; });
if (endModel.type === Models.ImageObjectType.POSITIONPOINT) {
var data = this.clonePositionPoint(endModel, relativePoint);
end = data.element;
relativePoint = data.relativePoint;
end.modeInteraction.setMode('clone_item_new');
}
else {
throw 'Fill collection not implemented';
}
}
line = this.createLineInstance(model, start.model, end.model);
}
if (!relativePoint) {
relativePoint = { x: 0, y: 0 };
}
return { element: line, relativePoint: relativePoint };
};
CloneItemGenerator.prototype.cloneFillCollection = function (model, relativePoint) {
if (relativePoint === void 0) { relativePoint = undefined; }
var fillCollection;
var fillCollectionMapping = this.data.imageObjectMappings.find(function (mapping) { return mapping.old.id === model.id; });
if (fillCollectionMapping) {
fillCollection = this.target.getImageObjects().find(function (imageObject) { return imageObject.name === fillCollectionMapping.new.id; });
}
else {
var lineModels = this.data.imageObjects.filter(function (imageObject) { return model.lines.indexOf(imageObject.id) > -1; });
var fillLines = [];
for (var _i = 0, lineModels_1 = lineModels; _i < lineModels_1.length; _i++) {
var lineModel = lineModels_1[_i];
var data = this.cloneLine(lineModel, relativePoint);
var line = data.element;
relativePoint = data.relativePoint;
line.modeInteraction.setMode('clone_item_new');
fillLines.push(line.name);
}
fillCollection = this.createFillCollectionInstance(model, fillLines);
}
if (!relativePoint) {
relativePoint = { x: 0, y: 0 };
}
return { element: fillCollection, relativePoint: relativePoint };
};
CloneItemGenerator.prototype.cloneLegendCollection = function (model, relativePoint) {
if (relativePoint === void 0) { relativePoint = undefined; }
if (!relativePoint) {
relativePoint = model.rectangle;
}
var legendCollection;
var legendCollectionMapping = this.data.imageObjectMappings.find(function (mapping) { return mapping.old.id === model.id; });
if (legendCollectionMapping) {
legendCollection = this.target.getImageObjects().find(function (imageObject) { return imageObject.name === legendCollectionMapping.new.id; });
}
else {
legendCollection = this.createLegendInstance(model, relativePoint);
}
return { element: legendCollection, relativePoint: relativePoint };
};
CloneItemGenerator.prototype._positionPointOnReset = function (model, positionPoint, relativePoint) {
var imageWidth = this.target.imageDimensions.width;
var pos = this.target.renderer.plugins.interaction.mouse.global;
var rect = this.target.getRectangle();
positionPoint.position.x = (model.position.x - relativePoint.x) * imageWidth + (pos.x - rect.x) / this.target.scale.x;
positionPoint.position.y = (model.position.y - relativePoint.y) * imageWidth + (pos.y - rect.y) / this.target.scale.y;
var event = new PIXI.InteractionEvent();
event.data = new PIXI.InteractionData();
event.data.global = pos;
this.cloneInteraction.resetClone(event);
positionPoint.emit("onPositionPointMove");
};
CloneItemGenerator.prototype._positionPointOnZoom = function (model, positionPoint, relativePoint) {
var imageWidth = this.target.imageDimensions.width;
var pos = this.target.renderer.plugins.interaction.mouse.global;
var rect = this.target.getRectangle();
positionPoint.position.x = (model.position.x - relativePoint.x) * imageWidth + (pos.x - rect.x) / this.target.scale.x;
positionPoint.position.y = (model.position.y - relativePoint.y) * imageWidth + (pos.y - rect.y) / this.target.scale.y;
var event = new PIXI.InteractionEvent();
event.data = new PIXI.InteractionData();
event.data.global = pos;
this.cloneInteraction.resetClone(event);
positionPoint.emit("onPositionPointMove");
};
CloneItemGenerator.prototype._legendCollectionOnZoom = function (model, legendCollection, relativePoint) {
var imageWidth = this.target.imageDimensions.width;
var pos = this.target.renderer.plugins.interaction.mouse.global;
var rect = this.target.getRectangle();
legendCollection.position.x = (model.rectangle.x - relativePoint.x) * imageWidth + (pos.x - rect.x) / this.target.scale.x;
legendCollection.position.y = (model.rectangle.y - relativePoint.y) * imageWidth + (pos.y - rect.y) / this.target.scale.y;
var event = new PIXI.InteractionEvent();
event.data = new PIXI.InteractionData();
event.data.global = pos;
this.cloneInteraction.resetClone(event);
};
CloneItemGenerator.prototype.createPositionPointInstance = function (model, relativePoint) {
var positionPointModel = this.createPositionPointModel(model, relativePoint);
var positionPoint = new MedsurfDraw.PositionPoint(this.target, positionPointModel);
this.target.addImageObject(positionPoint.model, this.data.layerGroup, this.data.image);
this.data.imageObjectMappings.push({
new: positionPoint.model,
old: model
});
var onZoomMethod = this._positionPointOnZoom.bind(this, model, positionPoint, relativePoint);
this.on("onZoom", onZoomMethod);
this.cloneInteraction.on("startClone", positionPoint.moveInteraction.startMove, positionPoint.moveInteraction);
this.cloneInteraction.on("resetClone", positionPoint.moveInteraction.resetMove, positionPoint.moveInteraction);
this.cloneInteraction.on("onClone", positionPoint.moveInteraction.onMove, positionPoint.moveInteraction);
this.cloneInteraction.once("endClone", positionPoint.moveInteraction.endMove, positionPoint.moveInteraction);
this.target.addChild(positionPoint);
if (!positionPoint.model.primitives) {
positionPoint.model.primitives = [];
}
for (var _i = 0, _a = model.primitives || []; _i < _a.length; _i++) {
var primitive = _a[_i];
switch (primitive.type) {
case Models.ImageObjectType.ARROW:
var arrowPrimitive = this.createArrowPrimitiveInstance(primitive, positionPoint.model);
positionPoint.model.primitives.push(arrowPrimitive.model);
positionPoint.addChild(arrowPrimitive);
arrowPrimitive.showItem();
break;
case Models.ImageObjectType.ELLIPSE:
var ellipsePrimitive = this.createEllipsePrimitiveInstance(primitive, positionPoint.model);
positionPoint.model.primitives.push(ellipsePrimitive.model);
positionPoint.addChild(ellipsePrimitive);
ellipsePrimitive.showItem();
break;
case Models.ImageObjectType.RECTANGLE:
var rectanglePrimitive = this.createRectanglePrimitiveInstance(primitive, positionPoint.model);
positionPoint.model.primitives.push(rectanglePrimitive.model);
positionPoint.addChild(rectanglePrimitive);
rectanglePrimitive.showItem();
break;
case Models.ImageObjectType.TEXT:
var textPrimitive = this.createTextPrimitiveInstance(primitive, positionPoint.model);
positionPoint.model.primitives.push(textPrimitive.model);
positionPoint.addChild(textPrimitive);
textPrimitive.showItem();
break;
}
}
return positionPoint;
};
CloneItemGenerator.prototype.createLineInstance = function (model, start, end) {
if (!start || !end) {
throw '1.1: position point not cloned';
}
var lineModel = this.createLineModel(model, start, end);
var line = new MedsurfDraw.Line(this.target, lineModel);
this.target.addImageObject(line.model, this.data.layerGroup, this.data.image);
this.data.imageObjectMappings.push({
new: line.model,
old: model
});
this.target.addChild(line);
return line;
};
CloneItemGenerator.prototype.createFillCollectionInstance = function (model, lines) {
if (!lines) {
throw '3.1: lines not cloned';
}
var fillCollectionModel = this.createFillCollectionModel(model, lines);
var fillCollection = new MedsurfDraw.FillCollection(this.target, fillCollectionModel);
this.target.addImageObject(fillCollection.model, this.data.layerGroup, this.data.image);
this.data.imageObjectMappings.push({
new: fillCollection.model,
old: model
});
this.target.addChild(fillCollection);
return fillCollection;
};
CloneItemGenerator.prototype.createLegendInstance = function (model, relativePoint) {
var legendCollectionModel = this.createLegendCollectionModel(model, relativePoint);
for (var _i = 0, _a = model.cols || []; _i < _a.length; _i++) {
var col = _a[_i];
var legendColumnModel = this.createLegendColumnModel(col, legendCollectionModel);
for (var _b = 0, _c = col.rows || []; _b < _c.length; _b++) {
var row = _c[_b];
var legendRowModel = this.createLegendRowModel(row, legendColumnModel);
legendColumnModel.rows.push(legendRowModel);
}
legendCollectionModel.cols.push(legendColumnModel);
}
var legendCollection = new MedsurfDraw.LegendCollection(this.target, legendCollectionModel);
this.target.addImageObject(legendCollection.model, this.data.layerGroup, this.data.image);
this.data.imageObjectMappings.push({
new: legendCollection.model,
old: model
});
var onZoomMethod = this._legendCollectionOnZoom.bind(this, model, legendCollection, relativePoint);
this.on("onZoom", onZoomMethod);
this.cloneInteraction.on("startClone", legendCollection.moveInteraction.startMove, legendCollection.moveInteraction);
this.cloneInteraction.on("resetClone", legendCollection.moveInteraction.resetMove, legendCollection.moveInteraction);
this.cloneInteraction.on("onClone", legendCollection.moveInteraction.onMove, legendCollection.moveInteraction);
this.cloneInteraction.once("endClone", legendCollection.moveInteraction.endMove, legendCollection.moveInteraction);
this.target.addChild(legendCollection);
return legendCollection;
};
CloneItemGenerator.prototype.createArrowPrimitiveInstance = function (model, positionPoint) {
if (!positionPoint) {
throw '1.2: position point not cloned';
}
var arrowPrimitiveModel = this.createArrowPrimitiveModel(model, positionPoint);
var arrowPrimitive = new MedsurfDraw.ArrowPrimitive(this.target, arrowPrimitiveModel);
this.data.imageObjectMappings.push({
new: arrowPrimitive.model,
old: model
});
return arrowPrimitive;
};
CloneItemGenerator.prototype.createEllipsePrimitiveInstance = function (model, positionPoint) {
if (!positionPoint) {
throw '1.3: position point not cloned';
}
var ellipsePrimitiveModel = this.createEllipsePrimitiveModel(model, positionPoint);
var ellipsePrimitive = new MedsurfDraw.EllipsePrimitive(this.target, ellipsePrimitiveModel);
this.data.imageObjectMappings.push({
new: ellipsePrimitive.model,
old: model
});
return ellipsePrimitive;
};
CloneItemGenerator.prototype.createRectanglePrimitiveInstance = function (model, positionPoint) {
if (!positionPoint) {
throw '1.4: position point not cloned';
}
var rectanglePrimitiveModel = this.createRectanglePrimitiveModel(model, positionPoint);
var rectanglePrimitive = new MedsurfDraw.RectanglePrimitive(this.target, rectanglePrimitiveModel);
this.data.imageObjectMappings.push({
new: rectanglePrimitive.model,
old: model
});
return rectanglePrimitive;
};
CloneItemGenerator.prototype.createTextPrimitiveInstance = function (model, positionPoint) {
if (!positionPoint) {
throw '1.5: position point not cloned';
}
var textPrimitiveModel = this.createTextPrimitiveModel(model, positionPoint);
var textPrimitive = new MedsurfDraw.TextPrimitive(this.target, textPrimitiveModel);
this.data.imageObjectMappings.push({
new: textPrimitive.model,
old: model
});
return textPrimitive;
};
CloneItemGenerator.prototype.createPositionPointModel = function (model, relativePoint) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.POSITIONPOINT,
image: model.image,
zIndex: model.zIndex,
isStatic: model.isStatic,
isSelftest: model.isSelftest,
selftestItems: [],
position: {
x: model.position.x - relativePoint.x,
y: model.position.y - relativePoint.y,
},
primitives: []
};
};
CloneItemGenerator.prototype.createLineModel = function (model, start, end) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.LINE,
image: model.image,
start: start.id,
end: end.id,
zIndex: model.zIndex,
isStatic: model.isStatic,
isBezier: model.isBezier,
interactWithLines: model.interactWithLines,
strokeWidth: model.strokeWidth,
options: JSON.parse(JSON.stringify(model.options)),
dashEmpty: model.dashEmpty,
dashFill: model.dashFill,
};
};
CloneItemGenerator.prototype.createFillCollectionModel = function (model, lines) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.FILLCOLLECTION,
image: model.image,
lines: lines,
zIndex: model.zIndex,
isStatic: model.isStatic,
isInteractive: model.isInteractive,
interactiveItems: [],
options: JSON.parse(JSON.stringify(model.options)),
linkedSite: model.linkedSite,
linkedSlideId: model.linkedSlideId,
};
};
CloneItemGenerator.prototype.createLegendCollectionModel = function (model, relativePoint) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.LEGENDCOLLECTION,
image: model.image,
zIndex: model.zIndex,
isStatic: model.isStatic,
selftestPoint: model.selftestPoint ?
{ x: model.selftestPoint.x, y: model.selftestPoint.y } :
undefined,
indexWidth: model.indexWidth,
columnDistance: model.columnDistance,
rowDistance: model.rowDistance,
rectangle: {
x: model.rectangle.x - relativePoint.x,
y: model.rectangle.y - relativePoint.y,
width: model.rectangle.width,
height: model.rectangle.height,
},
cols: [],
};
};
CloneItemGenerator.prototype.createLegendColumnModel = function (model, legendCollection) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.LEGENDCOLUMN,
image: model.image,
zIndex: model.zIndex,
isStatic: model.isStatic,
table: legendCollection,
rows: [],
};
};
CloneItemGenerator.prototype.createLegendRowModel = function (model, legendColumn) {
var imageWidth = this.target.imageDimensions.width;
var legendRowModel = {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.LEGENDROW,
image: model.image,
zIndex: model.zIndex,
isStatic: model.isStatic,
col: legendColumn,
text: model.text,
style: {
align: model.style.align,
fontSize: model.style.fontSize || 0 / imageWidth,
fill: model.style.fill,
fontFamily: model.style.fontFamily,
breakWords: model.style.breakWords,
},
};
return legendRowModel;
};
CloneItemGenerator.prototype.createArrowPrimitiveModel = function (model, positionPoint) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.ARROW,
image: model.image,
positionPoint: positionPoint,
zIndex: model.zIndex,
isStatic: model.isStatic,
wedgePoint: model.wedgePoint ?
{ x: model.wedgePoint.x, y: model.wedgePoint.y } :
undefined,
rotateWithLine: model.rotateWithLine,
rectangle: JSON.parse(JSON.stringify(model.rectangle)),
angle: model.angle,
strokeWidth: model.strokeWidth,
options: JSON.parse(JSON.stringify(model.options)),
dashEmpty: model.dashEmpty,
dashFill: model.dashFill,
};
};
CloneItemGenerator.prototype.createEllipsePrimitiveModel = function (model, positionPoint) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.ELLIPSE,
image: model.image,
positionPoint: positionPoint,
zIndex: model.zIndex,
isStatic: model.isStatic,
rotateWithLine: model.rotateWithLine,
ellipse: JSON.parse(JSON.stringify(model.ellipse)),
angle: model.angle,
strokeWidth: model.strokeWidth,
options: JSON.parse(JSON.stringify(model.options)),
dashEmpty: model.dashEmpty,
dashFill: model.dashFill,
};
};
CloneItemGenerator.prototype.createRectanglePrimitiveModel = function (model, positionPoint) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.RECTANGLE,
image: model.image,
positionPoint: positionPoint,
zIndex: model.zIndex,
isStatic: model.isStatic,
rotateWithLine: model.rotateWithLine,
rectangle: JSON.parse(JSON.stringify(model.rectangle)),
angle: model.angle,
strokeWidth: model.strokeWidth,
options: JSON.parse(JSON.stringify(model.options)),
dashEmpty: model.dashEmpty,
dashFill: model.dashFill,
};
};
CloneItemGenerator.prototype.createTextPrimitiveModel = function (model, positionPoint) {
return {
dirty: true,
id: uuidv4(),
type: Models.ImageObjectType.TEXT,
image: model.image,
positionPoint: positionPoint,
zIndex: model.zIndex,
isStatic: model.isStatic,
rotateWithLine: model.rotateWithLine,
rectangle: JSON.parse(JSON.stringify(model.rectangle)),
angle: model.angle,
text: model.text,
style: {
align: model.style.align,
fontSize: model.style.fontSize,
fill: model.style.fill,
fontFamily: model.style.fontFamily,
breakWords: model.style.breakWords,
},
};
};
CloneItemGenerator.prototype.endClone = function (event) {
event.stopPropagation();
this.emit("endGenerator", event);
this.end();
};
CloneItemGenerator.prototype.abortClone = function (event) {
event.stopPropagation();
this.emit("abortGenerator");
this.destroy();
};
CloneItemGenerator.prototype.onZoom = function () {
this.emit("onZoom");
};
Object.defineProperty(CloneItemGenerator.prototype, "cloneInteraction", {
get: function () {
return this._cloneInteraction;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CloneItemGenerator.prototype, "cloneElement", {
get: function () {
return this._cloneElement;
},
enumerable: false,
configurable: true
});
return CloneItemGenerator;
}(BaseGenerator));
export { CloneItemGenerator };
//# sourceMappingURL=CloneItemGenerator.js.map