@contrail/documents 1.3.9 → 1.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -86,11 +86,12 @@ class DocumentElementFactory {
|
|
|
86
86
|
return element;
|
|
87
87
|
}
|
|
88
88
|
static copyElements(elements, documentId, commonOptions = {}, positionOffset, lastFrameNumber) {
|
|
89
|
-
var _a;
|
|
89
|
+
var _a, _b;
|
|
90
90
|
const oldIdToNewId = new Map();
|
|
91
91
|
const newElements = [];
|
|
92
92
|
const groupElements = [];
|
|
93
93
|
const maskElements = [];
|
|
94
|
+
const calloutElements = [];
|
|
94
95
|
let frameNumber = lastFrameNumber;
|
|
95
96
|
for (const element of elements) {
|
|
96
97
|
if (['row', 'column', 'cell'].indexOf(element.type) !== -1)
|
|
@@ -154,6 +155,9 @@ class DocumentElementFactory {
|
|
|
154
155
|
newElement.position.x = newElement.position.x + positionOffset.x;
|
|
155
156
|
newElement.position.y = newElement.position.y + positionOffset.y;
|
|
156
157
|
}
|
|
158
|
+
if (['line', 'callout'].includes(newElement.type) && ((_b = newElement.points) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
159
|
+
newElement.points = newElement.points.map(([x, y]) => [x + positionOffset.x, y + positionOffset.y]);
|
|
160
|
+
}
|
|
157
161
|
}
|
|
158
162
|
newElement = DocumentElementFactory.createElement(element.type, newElement);
|
|
159
163
|
newElement.documentId = documentId;
|
|
@@ -161,6 +165,8 @@ class DocumentElementFactory {
|
|
|
161
165
|
oldIdToNewId.set(element.id, newElement.id);
|
|
162
166
|
newElements.push(newElement);
|
|
163
167
|
newElements.push(...newInnerElements);
|
|
168
|
+
if (newElement.type === 'callout')
|
|
169
|
+
calloutElements.push(newElement);
|
|
164
170
|
if (newElement.type === 'group')
|
|
165
171
|
groupElements.push(newElement);
|
|
166
172
|
if (DocumentElementFactory.isMask(newElement))
|
|
@@ -177,6 +183,20 @@ class DocumentElementFactory {
|
|
|
177
183
|
.filter((id) => !!id);
|
|
178
184
|
maskElement.elementIds = (newElementIds === null || newElementIds === void 0 ? void 0 : newElementIds.length) > 0 ? newElementIds : null;
|
|
179
185
|
});
|
|
186
|
+
calloutElements.forEach((calloutElement) => {
|
|
187
|
+
if (calloutElement.start.id) {
|
|
188
|
+
const startId = oldIdToNewId.get(calloutElement.start.id);
|
|
189
|
+
if (startId) {
|
|
190
|
+
calloutElement.start.id = startId;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (calloutElement.end.id) {
|
|
194
|
+
const endId = oldIdToNewId.get(calloutElement.end.id);
|
|
195
|
+
if (endId) {
|
|
196
|
+
calloutElement.end.id = endId;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
180
200
|
return { oldIdToNewId, newElements };
|
|
181
201
|
}
|
|
182
202
|
static isMask(element) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/documents",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "Documents library for contrail platform",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@contrail/actions": "^1.0.17",
|
|
42
42
|
"@contrail/document-table": "^1.0.5",
|
|
43
43
|
"@contrail/types": "^3.1.3",
|
|
44
|
-
"@contrail/document-util": "^1.0.
|
|
44
|
+
"@contrail/document-util": "^1.0.9",
|
|
45
45
|
"reflect-metadata": "^0.1.13"
|
|
46
46
|
}
|
|
47
47
|
}
|