@contrail/documents 1.19.0-alpha.75be757 → 1.19.0-alpha.8326aa7

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
@@ -19,11 +19,6 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
19
19
  are excluded.
20
20
  - `SECTION_ELEMENT_TYPE`, `FRAME_ELEMENT_TYPE` and `SHAPE_ELEMENT_TYPES` in
21
21
  `document-element-constants`, so the rule above has one definition rather than one per app.
22
- - `DocumentElementFactory.getBoundingClientRectScaled` — the space an element covers on the canvas,
23
- with `scale` applied. `getBoundingClientRect` keeps returning the element's own box before scale,
24
- which is what layout works in: `@contrail/document-table` places table members from it, and
25
- scaling it moves a scaled member into a different cell. Anything deciding what an element overlaps
26
- or sits on wants the scaled one.
27
22
 
28
23
  ### Deprecated
29
24
 
@@ -47,9 +42,12 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
47
42
 
48
43
  ### Changed
49
44
 
50
- - Container membership measures a scaled element from its scaled box, through the new
51
- `getBoundingClientRectScaled` below. A scaled element previously measured at its unscaled size
52
- and could resolve to the wrong container.
45
+ - Container membership measures a scaled element from its scaled box. Scale grows an element from
46
+ its top-left, so it widens the box and moves the centre; a scaled element previously measured at
47
+ its unscaled size and could resolve to the wrong container. Applied in
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.
53
51
 
54
52
  ## [1.18.0] - 2026-09-10
55
53
 
@@ -56,17 +56,19 @@ class DocumentContainerService {
56
56
  }));
57
57
  }
58
58
  static measure(documentElement, documentElementsById) {
59
- var _a, _b;
59
+ var _a, _b, _c, _d, _e, _f;
60
60
  if (!(documentElement === null || documentElement === void 0 ? void 0 : documentElement.position)) {
61
61
  return null;
62
62
  }
63
63
  try {
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
- const { x, y, width, height } = document_element_factory_1.DocumentElementFactory.getBoundingClientRectScaled(documentElement, start, end);
67
- return (0, document_container_1.toCoordinateBox)(x, y, width, height);
66
+ const { x, y, width, height } = document_element_factory_1.DocumentElementFactory.getBoundingClientRect(documentElement, start, end);
67
+ const scaleX = (_d = (_c = documentElement.scale) === null || _c === void 0 ? void 0 : _c.x) !== null && _d !== void 0 ? _d : 1;
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);
68
70
  }
69
- catch (_c) {
71
+ catch (_g) {
70
72
  return null;
71
73
  }
72
74
  }
@@ -22,12 +22,6 @@ export declare class DocumentElementFactory {
22
22
  width: any;
23
23
  height: any;
24
24
  };
25
- static getBoundingClientRectScaled(documentElement: DocumentElement, startElement?: DocumentElement, endElement?: DocumentElement): {
26
- x: any;
27
- y: any;
28
- width: any;
29
- height: any;
30
- };
31
25
  private static getPosition;
32
26
  private static getSize;
33
27
  private static getComponentSize;
@@ -216,16 +216,6 @@ class DocumentElementFactory {
216
216
  height,
217
217
  };
218
218
  }
219
- static getBoundingClientRectScaled(documentElement, startElement, endElement) {
220
- var _a, _b, _c, _d;
221
- const { x, y, width, height } = this.getBoundingClientRect(documentElement, startElement, endElement);
222
- return {
223
- x,
224
- y,
225
- width: width * ((_b = (_a = documentElement.scale) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 1),
226
- height: height * ((_d = (_c = documentElement.scale) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 1),
227
- };
228
- }
229
219
  static getPosition(documentElement, startElement, endElement) {
230
220
  var _a, _b;
231
221
  if (documentElement.type === 'line' || documentElement.type === 'callout') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.19.0-alpha.75be757",
3
+ "version": "1.19.0-alpha.8326aa7",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",