@contrail/documents 1.19.0-alpha.8326aa7 → 1.19.0-alpha.93befdf
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.
package/CHANGELOG.md
CHANGED
|
@@ -42,12 +42,9 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
42
42
|
|
|
43
43
|
### Changed
|
|
44
44
|
|
|
45
|
-
-
|
|
46
|
-
its top-left, so it widens the box and moves the centre; a
|
|
47
|
-
its unscaled size and could resolve to the wrong container.
|
|
48
|
-
`DocumentContainerService`, not in `DocumentElementFactory.getBoundingClientRect`, which is
|
|
49
|
-
unchanged: `@contrail/document-table` sizes table members from that box, and scaling it there
|
|
50
|
-
moved scaled members into different cells.
|
|
45
|
+
- `DocumentElementFactory.getBoundingClientRect` multiplies the measured size by the element's
|
|
46
|
+
`scale`. Scale grows an element from its top-left, so it widens the box and moves the centre; a
|
|
47
|
+
scaled element previously measured at its unscaled size and could resolve to the wrong container.
|
|
51
48
|
|
|
52
49
|
## [1.18.0] - 2026-09-10
|
|
53
50
|
|
|
@@ -56,7 +56,7 @@ class DocumentContainerService {
|
|
|
56
56
|
}));
|
|
57
57
|
}
|
|
58
58
|
static measure(documentElement, documentElementsById) {
|
|
59
|
-
var _a, _b
|
|
59
|
+
var _a, _b;
|
|
60
60
|
if (!(documentElement === null || documentElement === void 0 ? void 0 : documentElement.position)) {
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
@@ -64,11 +64,9 @@ class DocumentContainerService {
|
|
|
64
64
|
const start = ((_a = documentElement.start) === null || _a === void 0 ? void 0 : _a.id) ? documentElementsById.get(documentElement.start.id) : undefined;
|
|
65
65
|
const end = ((_b = documentElement.end) === null || _b === void 0 ? void 0 : _b.id) ? documentElementsById.get(documentElement.end.id) : undefined;
|
|
66
66
|
const { x, y, width, height } = document_element_factory_1.DocumentElementFactory.getBoundingClientRect(documentElement, start, end);
|
|
67
|
-
|
|
68
|
-
const scaleY = (_f = (_e = documentElement.scale) === null || _e === void 0 ? void 0 : _e.y) !== null && _f !== void 0 ? _f : 1;
|
|
69
|
-
return (0, document_container_1.toCoordinateBox)(x, y, width * scaleX, height * scaleY);
|
|
67
|
+
return (0, document_container_1.toCoordinateBox)(x, y, width, height);
|
|
70
68
|
}
|
|
71
|
-
catch (
|
|
69
|
+
catch (_c) {
|
|
72
70
|
return null;
|
|
73
71
|
}
|
|
74
72
|
}
|
|
@@ -207,13 +207,14 @@ class DocumentElementFactory {
|
|
|
207
207
|
return ['rectangle', 'circle'].indexOf(element === null || element === void 0 ? void 0 : element.type) !== -1 && ((_a = element === null || element === void 0 ? void 0 : element.elementIds) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
208
208
|
}
|
|
209
209
|
static getBoundingClientRect(documentElement, startElement, endElement) {
|
|
210
|
+
var _a, _b, _c, _d;
|
|
210
211
|
const { x, y } = this.getPosition(documentElement, startElement, endElement);
|
|
211
212
|
const { width, height } = this.getSize(documentElement, startElement, endElement);
|
|
212
213
|
return {
|
|
213
214
|
x,
|
|
214
215
|
y,
|
|
215
|
-
width,
|
|
216
|
-
height,
|
|
216
|
+
width: width * ((_b = (_a = documentElement.scale) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 1),
|
|
217
|
+
height: height * ((_d = (_c = documentElement.scale) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 1),
|
|
217
218
|
};
|
|
218
219
|
}
|
|
219
220
|
static getPosition(documentElement, startElement, endElement) {
|