@contrail/document-table 1.0.20-beta.0 → 1.0.20-beta.1
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.
|
@@ -12,6 +12,9 @@ class TableMemberPasteService {
|
|
|
12
12
|
const tableState = table_state_service_1.TableStateService.createTableState(tableEl, structureEls, 0);
|
|
13
13
|
const rowIds = (_a = tableEl.rowIds) !== null && _a !== void 0 ? _a : [];
|
|
14
14
|
const columnIds = (_b = tableEl.columnIds) !== null && _b !== void 0 ? _b : [];
|
|
15
|
+
const scale = (_d = (_c = tableEl.scale) === null || _c === void 0 ? void 0 : _c.x) !== null && _d !== void 0 ? _d : 1;
|
|
16
|
+
const tableX = (_f = (_e = tableEl.position) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0;
|
|
17
|
+
const tableY = (_h = (_g = tableEl.position) === null || _g === void 0 ? void 0 : _g.y) !== null && _h !== void 0 ? _h : 0;
|
|
15
18
|
for (const member of memberCandidates) {
|
|
16
19
|
const viewBox = documents_1.DocumentElementFactory.getBoundingClientRect(member);
|
|
17
20
|
if (!viewBox)
|
|
@@ -27,13 +30,13 @@ class TableMemberPasteService {
|
|
|
27
30
|
const cellState = tableState.cells.get(cellEl.id);
|
|
28
31
|
if (!cellState)
|
|
29
32
|
continue;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const offsetX = (
|
|
34
|
-
const offsetY = (
|
|
33
|
+
const isLine = member.type === 'line' && !!member.lineDefinition;
|
|
34
|
+
const anchorX = isLine ? member.lineDefinition.x1 : viewBox.x;
|
|
35
|
+
const anchorY = isLine ? member.lineDefinition.y1 : viewBox.y;
|
|
36
|
+
const offsetX = (anchorX - tableX) / scale - cellState.x;
|
|
37
|
+
const offsetY = (anchorY - tableY) / scale - cellState.y;
|
|
35
38
|
const entry = { gridRow, gridCol, offsetX, offsetY };
|
|
36
|
-
if (
|
|
39
|
+
if (isLine) {
|
|
37
40
|
entry.lineDx = member.lineDefinition.x2 - member.lineDefinition.x1;
|
|
38
41
|
entry.lineDy = member.lineDefinition.y2 - member.lineDefinition.y1;
|
|
39
42
|
}
|