ducjs 4.0.4 → 4.2.0
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/dist/duc_locator_wasm.d.ts +48 -0
- package/dist/duc_locator_wasm.js +296 -0
- package/dist/duc_locator_wasm_bg.wasm +0 -0
- package/dist/duc_locator_wasm_bg.wasm.d.ts +13 -0
- package/dist/ducjs_wasi.wasm +0 -0
- package/dist/ducjs_wasm.d.ts +14 -2
- package/dist/ducjs_wasm.js +96 -8
- package/dist/ducjs_wasm_bg.wasm +0 -0
- package/dist/ducjs_wasm_bg.wasm.d.ts +6 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/locator-runtime.d.ts +4 -0
- package/dist/locator-runtime.js +7 -0
- package/dist/restore/index.d.ts +1 -0
- package/dist/restore/index.js +1 -0
- package/dist/restore/restoreDataState.d.ts +13 -24
- package/dist/restore/restoreDataState.js +49 -83
- package/dist/restore/restoreElements.d.ts +10 -15
- package/dist/restore/restoreElements.js +128 -125
- package/dist/restore/updateModelCode.d.ts +11 -0
- package/dist/restore/updateModelCode.js +63 -0
- package/dist/thumbnails/bounds.d.ts +21 -0
- package/dist/thumbnails/bounds.js +84 -0
- package/dist/thumbnails/browserRunner.d.ts +60 -0
- package/dist/thumbnails/browserRunner.js +446 -0
- package/dist/thumbnails/cameraPresets.d.ts +47 -0
- package/dist/thumbnails/cameraPresets.js +222 -0
- package/dist/thumbnails/cli.d.ts +2 -0
- package/dist/thumbnails/cli.js +102 -0
- package/dist/thumbnails/index.d.ts +11 -0
- package/dist/thumbnails/index.js +11 -0
- package/dist/thumbnails/lib/clientBundle.min.js +10427 -0
- package/dist/thumbnails/lib/clientEntry.d.ts +3 -0
- package/dist/thumbnails/lib/clientEntry.js +8 -0
- package/dist/thumbnails/lib/clippingUtils.d.ts +10 -0
- package/dist/thumbnails/lib/clippingUtils.js +3 -0
- package/dist/thumbnails/lib/defaultModelColor.d.ts +3 -0
- package/dist/thumbnails/lib/defaultModelColor.js +22 -0
- package/dist/thumbnails/lib/index.d.ts +12 -0
- package/dist/thumbnails/lib/index.js +12 -0
- package/dist/thumbnails/lib/mapViewerStateToOptions.d.ts +34 -0
- package/dist/thumbnails/lib/mapViewerStateToOptions.js +69 -0
- package/dist/thumbnails/lib/offscreen-dxf-thumbnail.d.ts +16 -0
- package/dist/thumbnails/lib/offscreen-dxf-thumbnail.js +173 -0
- package/dist/thumbnails/lib/offscreen-model-thumbnail.d.ts +16 -0
- package/dist/thumbnails/lib/offscreen-model-thumbnail.js +209 -0
- package/dist/thumbnails/lib/parametricClip.d.ts +18 -0
- package/dist/thumbnails/lib/parametricClip.js +177 -0
- package/dist/thumbnails/lib/parametricShapes.d.ts +1 -0
- package/dist/thumbnails/lib/parametricShapes.js +75 -0
- package/dist/thumbnails/lib/parametricViewerState.d.ts +26 -0
- package/dist/thumbnails/lib/parametricViewerState.js +198 -0
- package/dist/thumbnails/lib/thumbnail-camera-fit.d.ts +6 -0
- package/dist/thumbnails/lib/thumbnail-camera-fit.js +292 -0
- package/dist/thumbnails/lib/thumbnail-capture.d.ts +23 -0
- package/dist/thumbnails/lib/thumbnail-capture.js +161 -0
- package/dist/thumbnails/lib/thumbnail-visibility.d.ts +12 -0
- package/dist/thumbnails/lib/thumbnail-visibility.js +97 -0
- package/dist/thumbnails/lib/viewerGrid.d.ts +13 -0
- package/dist/thumbnails/lib/viewerGrid.js +57 -0
- package/dist/thumbnails/modelCache.d.ts +56 -0
- package/dist/thumbnails/modelCache.js +165 -0
- package/dist/thumbnails/modelOutputArtifact.d.ts +19 -0
- package/dist/thumbnails/modelOutputArtifact.js +87 -0
- package/dist/thumbnails/render.d.ts +45 -0
- package/dist/thumbnails/render.js +162 -0
- package/dist/thumbnails/templates.d.ts +16 -0
- package/dist/thumbnails/templates.js +786 -0
- package/dist/thumbnails/tessellator.d.ts +33 -0
- package/dist/thumbnails/tessellator.js +349 -0
- package/dist/thumbnails/types.d.ts +233 -0
- package/dist/thumbnails/types.js +1 -0
- package/dist/thumbnails/worker.d.ts +10 -0
- package/dist/thumbnails/worker.js +119 -0
- package/dist/transform.d.ts +1 -1
- package/dist/transform.js +20 -22
- package/dist/types/elements/index.d.ts +22 -28
- package/dist/types/elements/index.js +0 -1
- package/dist/types/geometry.types.d.ts +5 -5
- package/dist/types/index.d.ts +13 -59
- package/dist/types/index.js +0 -1
- package/dist/types/issues.types.d.ts +1 -2
- package/dist/utils/bounds.d.ts +10 -11
- package/dist/utils/bounds.js +105 -84
- package/dist/utils/constants.d.ts +5 -7
- package/dist/utils/constants.js +10 -15
- package/dist/utils/elements/freedrawElement.js +6 -3
- package/dist/utils/elements/index.d.ts +2 -6
- package/dist/utils/elements/index.js +4 -9
- package/dist/utils/elements/linearElement.d.ts +12 -14
- package/dist/utils/elements/linearElement.js +81 -66
- package/dist/utils/elements/newElement.d.ts +37 -22
- package/dist/utils/elements/newElement.js +70 -64
- package/dist/utils/elements/textElement.d.ts +34 -35
- package/dist/utils/elements/textElement.js +79 -83
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/locator.d.ts +43 -0
- package/dist/utils/locator.js +112 -0
- package/dist/utils/math/bbox.d.ts +1 -2
- package/dist/utils/math/geometry.js +5 -4
- package/dist/utils/math/index.d.ts +13 -17
- package/dist/utils/math/index.js +53 -41
- package/dist/utils/math/random.js +7 -2
- package/dist/utils/normalize.d.ts +5 -5
- package/dist/utils/normalize.js +15 -10
- package/dist/utils/shape.d.ts +3 -4
- package/dist/utils/shape.js +64 -48
- package/dist/utils/state/index.d.ts +3 -4
- package/dist/utils/state/index.js +8 -23
- package/dist/wasi.js +38 -12
- package/package.json +23 -9
- package/dist/technical/index.d.ts +0 -2
- package/dist/technical/index.js +0 -2
- package/dist/technical/measurements.d.ts +0 -31
- package/dist/technical/measurements.js +0 -64
- package/dist/technical/scopes.d.ts +0 -261
- package/dist/technical/scopes.js +0 -676
- package/dist/types/typeChecks.d.ts +0 -5
- package/dist/types/typeChecks.js +0 -10
- package/dist/utils/traverse.d.ts +0 -30
- package/dist/utils/traverse.js +0 -124
package/dist/utils/bounds.js
CHANGED
|
@@ -1,46 +1,57 @@
|
|
|
1
1
|
import { isArrowElement, isFreeDrawElement, isLinearElement, isTextElement } from "../types/elements/typeChecks";
|
|
2
2
|
import { getBoundTextElementPosition, getLinearElementAbsoluteCoords } from "./elements/linearElement";
|
|
3
3
|
import { getCubicBezierBoundingBox, getQuadraticBezierBoundingBox, rescaleLines, rescalePoints, rotate } from "./math";
|
|
4
|
-
|
|
4
|
+
const toNum = (v) => { var _a; return typeof v === "number" ? v : ((_a = v === null || v === void 0 ? void 0 : v.value) !== null && _a !== void 0 ? _a : 0); };
|
|
5
|
+
export const getElementAbsoluteCoords = (element, elementsMap, includeBoundText = false, returnUnrotatedBoundsOnly = true) => {
|
|
5
6
|
if (isFreeDrawElement(element)) {
|
|
6
7
|
return getFreeDrawElementAbsoluteCoords(element);
|
|
7
8
|
}
|
|
8
9
|
else if (isLinearElement(element)) {
|
|
9
|
-
return getLinearElementAbsoluteCoords(element, elementsMap, includeBoundText,
|
|
10
|
+
return getLinearElementAbsoluteCoords(element, elementsMap, includeBoundText, returnUnrotatedBoundsOnly);
|
|
10
11
|
}
|
|
11
12
|
else if (isTextElement(element)) {
|
|
12
13
|
const container = elementsMap
|
|
13
14
|
? getContainerElement(element, elementsMap)
|
|
14
15
|
: null;
|
|
15
16
|
if (isArrowElement(container)) {
|
|
16
|
-
const coords = getBoundTextElementPosition(container, element, elementsMap
|
|
17
|
+
const coords = getBoundTextElementPosition(container, element, elementsMap);
|
|
17
18
|
if (coords === null) {
|
|
19
|
+
const ex = toNum(element.x);
|
|
20
|
+
const ey = toNum(element.y);
|
|
21
|
+
const ew = toNum(element.width);
|
|
22
|
+
const eh = toNum(element.height);
|
|
18
23
|
return [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
ex,
|
|
25
|
+
ey,
|
|
26
|
+
(ex + ew),
|
|
27
|
+
(ey + eh),
|
|
28
|
+
(ex + ew / 2),
|
|
29
|
+
(ey + eh / 2),
|
|
25
30
|
];
|
|
26
31
|
}
|
|
32
|
+
const ew = toNum(element.width);
|
|
33
|
+
const eh = toNum(element.height);
|
|
27
34
|
return [
|
|
28
35
|
coords.x,
|
|
29
36
|
coords.y,
|
|
30
|
-
coords.x +
|
|
31
|
-
coords.y +
|
|
32
|
-
coords.x +
|
|
33
|
-
coords.y +
|
|
37
|
+
(coords.x + ew),
|
|
38
|
+
(coords.y + eh),
|
|
39
|
+
(coords.x + ew / 2),
|
|
40
|
+
(coords.y + eh / 2),
|
|
34
41
|
];
|
|
35
42
|
}
|
|
36
43
|
}
|
|
44
|
+
const ex = toNum(element.x);
|
|
45
|
+
const ey = toNum(element.y);
|
|
46
|
+
const ew = toNum(element.width);
|
|
47
|
+
const eh = toNum(element.height);
|
|
37
48
|
return [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
ex,
|
|
50
|
+
ey,
|
|
51
|
+
(ex + ew),
|
|
52
|
+
(ey + eh),
|
|
53
|
+
(ex + ew / 2),
|
|
54
|
+
(ey + eh / 2),
|
|
44
55
|
];
|
|
45
56
|
};
|
|
46
57
|
/**
|
|
@@ -56,10 +67,10 @@ export const calculatePointsBounds = (points) => {
|
|
|
56
67
|
};
|
|
57
68
|
}
|
|
58
69
|
return points.reduce((limits, { x, y }) => ({
|
|
59
|
-
minX: Math.min(limits.minX, x
|
|
60
|
-
minY: Math.min(limits.minY, y
|
|
61
|
-
maxX: Math.max(limits.maxX, x
|
|
62
|
-
maxY: Math.max(limits.maxY, y
|
|
70
|
+
minX: Math.min(limits.minX, toNum(x)),
|
|
71
|
+
minY: Math.min(limits.minY, toNum(y)),
|
|
72
|
+
maxX: Math.max(limits.maxX, toNum(x)),
|
|
73
|
+
maxY: Math.max(limits.maxY, toNum(y)),
|
|
63
74
|
}), {
|
|
64
75
|
minX: Infinity,
|
|
65
76
|
minY: Infinity,
|
|
@@ -90,10 +101,10 @@ export const calculateGeometricPointsBounds = (points) => {
|
|
|
90
101
|
maxY = Math.max(maxY, y);
|
|
91
102
|
}
|
|
92
103
|
return {
|
|
93
|
-
minX
|
|
94
|
-
minY
|
|
95
|
-
maxX
|
|
96
|
-
maxY
|
|
104
|
+
minX,
|
|
105
|
+
minY,
|
|
106
|
+
maxX,
|
|
107
|
+
maxY,
|
|
97
108
|
};
|
|
98
109
|
};
|
|
99
110
|
/**
|
|
@@ -116,10 +127,10 @@ export const processBezierCurveBounds = (points, lines, initialBounds) => {
|
|
|
116
127
|
continue;
|
|
117
128
|
if (startHandle && endHandle) {
|
|
118
129
|
// Cubic Bezier curve segment (both handles present)
|
|
119
|
-
const p0 = { x: startPoint.x
|
|
120
|
-
const p1 = { x: startHandle.x
|
|
121
|
-
const p2 = { x: endHandle.x
|
|
122
|
-
const p3 = { x: endPoint.x
|
|
130
|
+
const p0 = { x: toNum(startPoint.x), y: toNum(startPoint.y) };
|
|
131
|
+
const p1 = { x: toNum(startHandle.x), y: toNum(startHandle.y) };
|
|
132
|
+
const p2 = { x: toNum(endHandle.x), y: toNum(endHandle.y) };
|
|
133
|
+
const p3 = { x: toNum(endPoint.x), y: toNum(endPoint.y) };
|
|
123
134
|
const bbox = getCubicBezierBoundingBox(p0, p1, p2, p3);
|
|
124
135
|
minX = Math.min(minX, bbox.minX);
|
|
125
136
|
minY = Math.min(minY, bbox.minY);
|
|
@@ -129,9 +140,9 @@ export const processBezierCurveBounds = (points, lines, initialBounds) => {
|
|
|
129
140
|
else if (startHandle || endHandle) {
|
|
130
141
|
// Quadratic Bezier curve segment (one handle present)
|
|
131
142
|
const controlHandle = startHandle || endHandle;
|
|
132
|
-
const p0 = { x: startPoint.x
|
|
133
|
-
const p1 = { x: controlHandle.x
|
|
134
|
-
const p2 = { x: endPoint.x
|
|
143
|
+
const p0 = { x: toNum(startPoint.x), y: toNum(startPoint.y) };
|
|
144
|
+
const p1 = { x: toNum(controlHandle.x), y: toNum(controlHandle.y) };
|
|
145
|
+
const p2 = { x: toNum(endPoint.x), y: toNum(endPoint.y) };
|
|
135
146
|
const bbox = getQuadraticBezierBoundingBox(p0, p1, p2);
|
|
136
147
|
minX = Math.min(minX, bbox.minX);
|
|
137
148
|
minY = Math.min(minY, bbox.minY);
|
|
@@ -163,24 +174,26 @@ export const processRotatedAbsoluteBezierBounds = (points, lines, elementX, elem
|
|
|
163
174
|
const endPoint = points[endIndex];
|
|
164
175
|
if (!startPoint || !endPoint)
|
|
165
176
|
continue;
|
|
177
|
+
const elX = toNum(elementX);
|
|
178
|
+
const elY = toNum(elementY);
|
|
166
179
|
// Convert to absolute coordinates
|
|
167
180
|
const absoluteStartPoint = {
|
|
168
|
-
x:
|
|
169
|
-
y:
|
|
181
|
+
x: elX + toNum(startPoint.x),
|
|
182
|
+
y: elY + toNum(startPoint.y),
|
|
170
183
|
};
|
|
171
184
|
const absoluteEndPoint = {
|
|
172
|
-
x:
|
|
173
|
-
y:
|
|
185
|
+
x: elX + toNum(endPoint.x),
|
|
186
|
+
y: elY + toNum(endPoint.y),
|
|
174
187
|
};
|
|
175
188
|
if (startHandle && endHandle) {
|
|
176
189
|
// Cubic Bezier curve segment
|
|
177
190
|
const absoluteStartHandle = {
|
|
178
|
-
x:
|
|
179
|
-
y:
|
|
191
|
+
x: elX + toNum(startHandle.x),
|
|
192
|
+
y: elY + toNum(startHandle.y),
|
|
180
193
|
};
|
|
181
194
|
const absoluteEndHandle = {
|
|
182
|
-
x:
|
|
183
|
-
y:
|
|
195
|
+
x: elX + toNum(endHandle.x),
|
|
196
|
+
y: elY + toNum(endHandle.y),
|
|
184
197
|
};
|
|
185
198
|
const p0 = rotate(absoluteStartPoint.x, absoluteStartPoint.y, centerX, centerY, angle);
|
|
186
199
|
const p1 = rotate(absoluteStartHandle.x, absoluteStartHandle.y, centerX, centerY, angle);
|
|
@@ -196,8 +209,8 @@ export const processRotatedAbsoluteBezierBounds = (points, lines, elementX, elem
|
|
|
196
209
|
// Quadratic Bezier curve segment
|
|
197
210
|
const controlHandle = startHandle || endHandle;
|
|
198
211
|
const absoluteControlHandle = {
|
|
199
|
-
x:
|
|
200
|
-
y:
|
|
212
|
+
x: elX + toNum(controlHandle.x),
|
|
213
|
+
y: elY + toNum(controlHandle.y),
|
|
201
214
|
};
|
|
202
215
|
const p0 = rotate(absoluteStartPoint.x, absoluteStartPoint.y, centerX, centerY, angle);
|
|
203
216
|
const p1 = rotate(absoluteControlHandle.x, absoluteControlHandle.y, centerX, centerY, angle);
|
|
@@ -238,14 +251,14 @@ export const processRelativeBezierBounds = (points, lines, initialBounds) => {
|
|
|
238
251
|
const p1 = points[p1_idx];
|
|
239
252
|
const p2 = points[p2_idx];
|
|
240
253
|
if (line[0].handle || line[1].handle) {
|
|
241
|
-
const p0 = { x: p1.x
|
|
242
|
-
const p3 = { x: p2.x
|
|
254
|
+
const p0 = { x: toNum(p1.x), y: toNum(p1.y) };
|
|
255
|
+
const p3 = { x: toNum(p2.x), y: toNum(p2.y) };
|
|
243
256
|
const h1 = line[0].handle;
|
|
244
257
|
const h2 = line[1].handle;
|
|
245
258
|
try {
|
|
246
259
|
if (h1 && h2) {
|
|
247
|
-
const cp1 = { x: h1.x
|
|
248
|
-
const cp2 = { x: h2.x
|
|
260
|
+
const cp1 = { x: toNum(h1.x), y: toNum(h1.y) };
|
|
261
|
+
const cp2 = { x: toNum(h2.x), y: toNum(h2.y) };
|
|
249
262
|
const bbox = getCubicBezierBoundingBox(p0, cp1, cp2, p3);
|
|
250
263
|
minX = Math.min(minX, bbox.minX);
|
|
251
264
|
minY = Math.min(minY, bbox.minY);
|
|
@@ -253,7 +266,7 @@ export const processRelativeBezierBounds = (points, lines, initialBounds) => {
|
|
|
253
266
|
maxY = Math.max(maxY, bbox.maxY);
|
|
254
267
|
}
|
|
255
268
|
else if (h1) {
|
|
256
|
-
const cp1 = { x: h1.x
|
|
269
|
+
const cp1 = { x: toNum(h1.x), y: toNum(h1.y) };
|
|
257
270
|
const bbox = getQuadraticBezierBoundingBox(p0, cp1, p3);
|
|
258
271
|
minX = Math.min(minX, bbox.minX);
|
|
259
272
|
minY = Math.min(minY, bbox.minY);
|
|
@@ -261,7 +274,7 @@ export const processRelativeBezierBounds = (points, lines, initialBounds) => {
|
|
|
261
274
|
maxY = Math.max(maxY, bbox.maxY);
|
|
262
275
|
}
|
|
263
276
|
else if (h2) {
|
|
264
|
-
const cp2 = { x: h2.x
|
|
277
|
+
const cp2 = { x: toNum(h2.x), y: toNum(h2.y) };
|
|
265
278
|
const bbox = getQuadraticBezierBoundingBox(p0, cp2, p3);
|
|
266
279
|
minX = Math.min(minX, bbox.minX);
|
|
267
280
|
minY = Math.min(minY, bbox.minY);
|
|
@@ -290,16 +303,18 @@ export const calculateShapeBounds = (points, lines) => {
|
|
|
290
303
|
*/
|
|
291
304
|
export const calculatePointsBoundsWithCenter = (points) => {
|
|
292
305
|
const bounds = calculatePointsBounds(points);
|
|
293
|
-
return Object.assign(Object.assign({}, bounds), { cx: (
|
|
306
|
+
return Object.assign(Object.assign({}, bounds), { cx: (bounds.maxX + bounds.minX) / 2, cy: (bounds.maxY + bounds.minY) / 2 });
|
|
294
307
|
};
|
|
295
308
|
export const getElementPointsCoords = (element, points) => {
|
|
296
|
-
var _a, _b
|
|
309
|
+
var _a, _b;
|
|
310
|
+
const ex = toNum(element.x);
|
|
311
|
+
const ey = toNum(element.y);
|
|
297
312
|
if (!points || !Array.isArray(points) || points.length === 0) {
|
|
298
313
|
return [
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
314
|
+
ex,
|
|
315
|
+
ey,
|
|
316
|
+
ex,
|
|
317
|
+
ey,
|
|
303
318
|
];
|
|
304
319
|
}
|
|
305
320
|
let minX = Infinity;
|
|
@@ -308,10 +323,10 @@ export const getElementPointsCoords = (element, points) => {
|
|
|
308
323
|
let maxY = -Infinity;
|
|
309
324
|
// First, include all the actual points (these are always on the path)
|
|
310
325
|
for (const point of points) {
|
|
311
|
-
minX = Math.min(minX, point.x
|
|
312
|
-
minY = Math.min(minY, point.y
|
|
313
|
-
maxX = Math.max(maxX, point.x
|
|
314
|
-
maxY = Math.max(maxY, point.y
|
|
326
|
+
minX = Math.min(minX, toNum(point.x));
|
|
327
|
+
minY = Math.min(minY, toNum(point.y));
|
|
328
|
+
maxX = Math.max(maxX, toNum(point.x));
|
|
329
|
+
maxY = Math.max(maxY, toNum(point.y));
|
|
315
330
|
}
|
|
316
331
|
const lines = element.lines || [];
|
|
317
332
|
// Use the shared utility for relative Bezier bounds calculation
|
|
@@ -321,17 +336,17 @@ export const getElementPointsCoords = (element, points) => {
|
|
|
321
336
|
maxX = bezierBounds.maxX;
|
|
322
337
|
maxY = bezierBounds.maxY;
|
|
323
338
|
// Account for stroke width
|
|
324
|
-
const strokeWidth = ((
|
|
339
|
+
const strokeWidth = toNum((_b = (_a = element.stroke) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.width) || 0;
|
|
325
340
|
const strokeOffset = strokeWidth / 2;
|
|
326
341
|
minX -= strokeOffset;
|
|
327
342
|
minY -= strokeOffset;
|
|
328
343
|
maxX += strokeOffset;
|
|
329
344
|
maxY += strokeOffset;
|
|
330
345
|
return [
|
|
331
|
-
(minX +
|
|
332
|
-
(minY +
|
|
333
|
-
(maxX +
|
|
334
|
-
(maxY +
|
|
346
|
+
(minX + ex),
|
|
347
|
+
(minY + ey),
|
|
348
|
+
(maxX + ex),
|
|
349
|
+
(maxY + ey),
|
|
335
350
|
];
|
|
336
351
|
};
|
|
337
352
|
export const getContainerElement = (element, elementsMap) => {
|
|
@@ -349,11 +364,13 @@ export const getBoundsFromPoints = (points) => {
|
|
|
349
364
|
return [bounds.minX, bounds.minY, bounds.maxX, bounds.maxY];
|
|
350
365
|
};
|
|
351
366
|
export const getFreeDrawElementAbsoluteCoords = (element) => {
|
|
352
|
-
const [minX, minY, maxX, maxY] = getBoundsFromPoints(element.points.map((p) => ({ x: p.x
|
|
353
|
-
const
|
|
354
|
-
const
|
|
355
|
-
const
|
|
356
|
-
const
|
|
367
|
+
const [minX, minY, maxX, maxY] = getBoundsFromPoints(element.points.map((p) => ({ x: toNum(p.x), y: toNum(p.y) })));
|
|
368
|
+
const ex = toNum(element.x);
|
|
369
|
+
const ey = toNum(element.y);
|
|
370
|
+
const x1 = minX + ex;
|
|
371
|
+
const y1 = minY + ey;
|
|
372
|
+
const x2 = maxX + ex;
|
|
373
|
+
const y2 = maxY + ey;
|
|
357
374
|
return [
|
|
358
375
|
x1,
|
|
359
376
|
y1,
|
|
@@ -380,34 +397,38 @@ export const getBoundTextElement = (element, elementsMap) => {
|
|
|
380
397
|
}
|
|
381
398
|
return null;
|
|
382
399
|
};
|
|
383
|
-
export const getResizedElementAbsoluteCoords = (element, nextWidth, nextHeight, normalizePoints
|
|
400
|
+
export const getResizedElementAbsoluteCoords = (element, nextWidth, nextHeight, normalizePoints) => {
|
|
401
|
+
const ex = toNum(element.x);
|
|
402
|
+
const ey = toNum(element.y);
|
|
403
|
+
const nw = toNum(nextWidth);
|
|
404
|
+
const nh = toNum(nextHeight);
|
|
384
405
|
if (!(isLinearElement(element) || isFreeDrawElement(element))) {
|
|
385
406
|
return [
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
(
|
|
389
|
-
(
|
|
407
|
+
ex,
|
|
408
|
+
ey,
|
|
409
|
+
(ex + nw),
|
|
410
|
+
(ey + nh),
|
|
390
411
|
];
|
|
391
412
|
}
|
|
392
|
-
const pointsAfterYRescale = rescalePoints("y", nextHeight, element.points, normalizePoints
|
|
393
|
-
const points = rescalePoints("x", nextWidth, pointsAfterYRescale, normalizePoints
|
|
413
|
+
const pointsAfterYRescale = rescalePoints("y", nextHeight, element.points, normalizePoints);
|
|
414
|
+
const points = rescalePoints("x", nextWidth, pointsAfterYRescale, normalizePoints);
|
|
394
415
|
if (isFreeDrawElement(element)) {
|
|
395
|
-
const bounds = getBoundsFromPoints(points.map((p) => ({ x: p.x
|
|
416
|
+
const bounds = getBoundsFromPoints(points.map((p) => ({ x: toNum(p.x), y: toNum(p.y) })));
|
|
396
417
|
const [minX, minY, maxX, maxY] = bounds;
|
|
397
418
|
return [
|
|
398
|
-
(minX +
|
|
399
|
-
(minY +
|
|
400
|
-
(maxX +
|
|
401
|
-
(maxY +
|
|
419
|
+
(minX + ex),
|
|
420
|
+
(minY + ey),
|
|
421
|
+
(maxX + ex),
|
|
422
|
+
(maxY + ey),
|
|
402
423
|
];
|
|
403
424
|
}
|
|
404
425
|
else {
|
|
405
426
|
// Linear element
|
|
406
427
|
const linesAfterYRescale = element.lines
|
|
407
|
-
? rescaleLines("y", nextHeight, element.lines, element.points, normalizePoints
|
|
428
|
+
? rescaleLines("y", nextHeight, element.lines, element.points, normalizePoints)
|
|
408
429
|
: [];
|
|
409
430
|
const rescaledLines = element.lines
|
|
410
|
-
? rescaleLines("x", nextWidth, linesAfterYRescale, element.points, normalizePoints
|
|
431
|
+
? rescaleLines("x", nextWidth, linesAfterYRescale, element.points, normalizePoints)
|
|
411
432
|
: [];
|
|
412
433
|
return getElementPointsCoords(Object.assign(Object.assign({}, element), { points, lines: rescaledLines }), points);
|
|
413
434
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MAX_ZOOM, MIN_ZOOM } from "../technical/scopes";
|
|
2
|
-
import { RawValue } from "../types";
|
|
3
1
|
import { DucElement, DucEllipseElement, DucFreeDrawElement, DucTextElement, ElementBackground, ElementStroke, FontFamilyValues } from "../types/elements";
|
|
2
|
+
export declare const MIN_ZOOM = 1e-32;
|
|
3
|
+
export declare const MAX_ZOOM = 1e+32;
|
|
4
4
|
export declare const COLOR_PALETTE: {
|
|
5
5
|
readonly transparent: "transparent";
|
|
6
6
|
readonly black: "#1e1e1e";
|
|
@@ -40,7 +40,7 @@ export declare const MIME_TYPES: {
|
|
|
40
40
|
readonly avif: "image/avif";
|
|
41
41
|
readonly jfif: "image/jfif";
|
|
42
42
|
readonly json: "application/json";
|
|
43
|
-
readonly duc: "application/vnd.duc
|
|
43
|
+
readonly duc: "application/vnd.duc";
|
|
44
44
|
readonly ducfig: "application/vnd.duc-config";
|
|
45
45
|
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
46
46
|
readonly "excalidraw.svg": "image/svg+xml";
|
|
@@ -70,7 +70,7 @@ export declare const EXPORT_DATA_TYPES: {
|
|
|
70
70
|
readonly excalidrawLibrary: "excalidrawlib";
|
|
71
71
|
readonly ducClipboardWithAPI: "duc-api/clipboard";
|
|
72
72
|
};
|
|
73
|
-
export declare const SUPPORTED_DATA_TYPES: ("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif" | "application/json" | "application/vnd.duc
|
|
73
|
+
export declare const SUPPORTED_DATA_TYPES: ("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif" | "application/json" | "application/vnd.duc" | "application/vnd.duc-config" | "application/pdf" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "text/csv" | "text/markdown" | "model/step" | "application/step" | "model/stl")[];
|
|
74
74
|
export declare const VERSIONS: {
|
|
75
75
|
readonly excalidraw: 2;
|
|
76
76
|
readonly excalidrawLibrary: 2;
|
|
@@ -78,7 +78,6 @@ export declare const VERSIONS: {
|
|
|
78
78
|
export declare const DEFAULT_ZOOM_STEP = 0.1;
|
|
79
79
|
export declare const MIN_ZOOM_STEP = 1e-7;
|
|
80
80
|
export declare const MAX_ZOOM_STEP = 5;
|
|
81
|
-
export { MAX_ZOOM, MIN_ZOOM };
|
|
82
81
|
export declare const BOUND_TEXT_PADDING = 5;
|
|
83
82
|
export declare const ARROW_LABEL_WIDTH_FRACTION = 0.7;
|
|
84
83
|
export declare const ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO = 11;
|
|
@@ -148,7 +147,6 @@ export declare const DEFAULT_ELEMENT_PROPS: {
|
|
|
148
147
|
roundness: DucElement["roundness"];
|
|
149
148
|
opacity: DucElement["opacity"];
|
|
150
149
|
locked: DucElement["locked"];
|
|
151
|
-
scope: DucElement["scope"];
|
|
152
150
|
index: DucElement["index"];
|
|
153
151
|
width: DucElement["width"];
|
|
154
152
|
height: DucElement["height"];
|
|
@@ -165,7 +163,7 @@ export declare const DEFAULT_IFRAME_LIKE_NO_STYLE: {
|
|
|
165
163
|
};
|
|
166
164
|
export declare const DEFAULT_LINEAR_ELEMENT_STROKE: ElementStroke;
|
|
167
165
|
export declare const DEFAULT_FREEDRAW_ELEMENT: {
|
|
168
|
-
size:
|
|
166
|
+
size: number;
|
|
169
167
|
thinning: DucFreeDrawElement["thinning"];
|
|
170
168
|
smoothing: DucFreeDrawElement["smoothing"];
|
|
171
169
|
streamline: DucFreeDrawElement["streamline"];
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ELEMENT_CONTENT_PREFERENCE, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN } from "../enums";
|
|
2
|
-
|
|
2
|
+
export const MIN_ZOOM = 1e-32;
|
|
3
|
+
export const MAX_ZOOM = 1e32;
|
|
3
4
|
export const COLOR_PALETTE = {
|
|
4
5
|
transparent: "transparent",
|
|
5
6
|
black: "#1e1e1e",
|
|
@@ -32,11 +33,7 @@ export const IMAGE_MIME_TYPES = {
|
|
|
32
33
|
avif: "image/avif",
|
|
33
34
|
jfif: "image/jfif",
|
|
34
35
|
};
|
|
35
|
-
export const MIME_TYPES = Object.assign({ json: "application/json",
|
|
36
|
-
// excalidraw data
|
|
37
|
-
duc: "application/vnd.duc-cad", ducfig: "application/vnd.duc-config", excalidrawlib: "application/vnd.excalidrawlib+json",
|
|
38
|
-
// image-encoded excalidraw data
|
|
39
|
-
"excalidraw.svg": "image/svg+xml", "excalidraw.png": "image/png", binary: "application/octet-stream", pdf: "application/pdf", zip: "application/zip", xls: "application/vnd.ms-excel", xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", doc: "application/msword", docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", csv: "text/csv", markdown: "text/markdown", step: "model/step", stp: "application/step", stl: "model/stl" }, IMAGE_MIME_TYPES);
|
|
36
|
+
export const MIME_TYPES = Object.assign({ json: "application/json", duc: "application/vnd.duc", ducfig: "application/vnd.duc-config", excalidrawlib: "application/vnd.excalidrawlib+json", "excalidraw.svg": "image/svg+xml", "excalidraw.png": "image/png", binary: "application/octet-stream", pdf: "application/pdf", zip: "application/zip", xls: "application/vnd.ms-excel", xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", doc: "application/msword", docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", csv: "text/csv", markdown: "text/markdown", step: "model/step", stp: "application/step", stl: "model/stl" }, IMAGE_MIME_TYPES);
|
|
40
37
|
export const EXPORT_IMAGE_TYPES = {
|
|
41
38
|
png: "png",
|
|
42
39
|
svg: "svg",
|
|
@@ -72,7 +69,6 @@ export const VERSIONS = {
|
|
|
72
69
|
export const DEFAULT_ZOOM_STEP = 0.1;
|
|
73
70
|
export const MIN_ZOOM_STEP = 0.0000001;
|
|
74
71
|
export const MAX_ZOOM_STEP = 5;
|
|
75
|
-
export { MAX_ZOOM, MIN_ZOOM };
|
|
76
72
|
export const BOUND_TEXT_PADDING = 5;
|
|
77
73
|
export const ARROW_LABEL_WIDTH_FRACTION = 0.7;
|
|
78
74
|
export const ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO = 11;
|
|
@@ -194,7 +190,7 @@ export const DEFAULT_FRAME_STYLE = ({
|
|
|
194
190
|
visible: true,
|
|
195
191
|
opacity: 1,
|
|
196
192
|
},
|
|
197
|
-
width:
|
|
193
|
+
width: 2,
|
|
198
194
|
style: {
|
|
199
195
|
preference: STROKE_PREFERENCE.SOLID,
|
|
200
196
|
join: STROKE_JOIN.MITER,
|
|
@@ -209,7 +205,7 @@ export const DEFAULT_FRAME_STYLE = ({
|
|
|
209
205
|
opacity: 0.1,
|
|
210
206
|
},
|
|
211
207
|
}],
|
|
212
|
-
roundness:
|
|
208
|
+
roundness: 0,
|
|
213
209
|
radius: 8,
|
|
214
210
|
nameOffsetY: 3,
|
|
215
211
|
nameColorLightTheme: "#80808080",
|
|
@@ -225,7 +221,7 @@ export const DEFAULT_ELEMENT_PROPS = {
|
|
|
225
221
|
visible: true,
|
|
226
222
|
opacity: 1,
|
|
227
223
|
},
|
|
228
|
-
width:
|
|
224
|
+
width: 2,
|
|
229
225
|
style: {
|
|
230
226
|
preference: STROKE_PREFERENCE.SOLID,
|
|
231
227
|
join: STROKE_JOIN.MITER,
|
|
@@ -242,13 +238,12 @@ export const DEFAULT_ELEMENT_PROPS = {
|
|
|
242
238
|
},
|
|
243
239
|
isVisible: true,
|
|
244
240
|
isPlot: true,
|
|
245
|
-
roundness:
|
|
241
|
+
roundness: 0,
|
|
246
242
|
opacity: 1,
|
|
247
243
|
locked: false,
|
|
248
|
-
scope: NEUTRAL_SCOPE,
|
|
249
244
|
index: null,
|
|
250
|
-
width:
|
|
251
|
-
height:
|
|
245
|
+
width: 0,
|
|
246
|
+
height: 0,
|
|
252
247
|
angle: 0,
|
|
253
248
|
groupIds: [],
|
|
254
249
|
frameId: null,
|
|
@@ -341,7 +336,7 @@ export const PREDEFINED_HATCH_PATTERNS = {
|
|
|
341
336
|
// visible: true,
|
|
342
337
|
// opacity: 1,
|
|
343
338
|
// },
|
|
344
|
-
// width:
|
|
339
|
+
// width: 1,
|
|
345
340
|
// style: {
|
|
346
341
|
// preference: "solid",
|
|
347
342
|
// scale: 1,
|
|
@@ -23,8 +23,10 @@ function getSvgPathFromStroke(points) {
|
|
|
23
23
|
.replace(TO_FIXED_PRECISION, "$1");
|
|
24
24
|
}
|
|
25
25
|
function buildStrokeOptions(element) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const size = (_b = (_a = element.size) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : element.size;
|
|
26
28
|
return {
|
|
27
|
-
size
|
|
29
|
+
size,
|
|
28
30
|
simulatePressure: element.simulatePressure,
|
|
29
31
|
thinning: element.thinning,
|
|
30
32
|
smoothing: element.smoothing,
|
|
@@ -42,9 +44,10 @@ const normalizeStrokePressure = (pressure) => {
|
|
|
42
44
|
return Math.min(1, Math.max(0.05, pressure));
|
|
43
45
|
};
|
|
44
46
|
function buildInputPoints(element) {
|
|
47
|
+
const toNum = (v) => { var _a; return typeof v === "number" ? v : ((_a = v === null || v === void 0 ? void 0 : v.value) !== null && _a !== void 0 ? _a : 0); };
|
|
45
48
|
return element.simulatePressure
|
|
46
|
-
? element.points.map(({ x, y }) => [x
|
|
47
|
-
: element.points.map(({ x, y }, i) => [x
|
|
49
|
+
? element.points.map(({ x, y }) => [toNum(x), toNum(y)])
|
|
50
|
+
: element.points.map(({ x, y }, i) => [toNum(x), toNum(y), normalizeStrokePressure(element.pressures[i])]);
|
|
48
51
|
}
|
|
49
52
|
export function getFreeDrawSvgPath(element) {
|
|
50
53
|
if (element.points.length === 0) {
|
|
@@ -3,14 +3,10 @@ export * from "./freedrawElement";
|
|
|
3
3
|
export * from "./linearElement";
|
|
4
4
|
export * from "./newElement";
|
|
5
5
|
export * from "./textElement";
|
|
6
|
-
import { Scope } from "../../types";
|
|
7
6
|
import { _DucStackBase, DucElement, DucNonSelectionElement, DucTableElement, DucTextStyle, ElementConstructorOpts, NonDeleted } from "../../types/elements";
|
|
8
7
|
import { GeometricPoint, TuplePoint } from "../../types/geometry.types";
|
|
9
8
|
import { Mutable } from "../../types/utility.types";
|
|
10
|
-
|
|
11
|
-
* Returns a default DucTextStyle object for the given scope.
|
|
12
|
-
*/
|
|
13
|
-
export declare function getDefaultTextStyle(currentScope: Scope): DucTextStyle;
|
|
9
|
+
export declare function getDefaultTextStyle(): DucTextStyle;
|
|
14
10
|
/**
|
|
15
11
|
* Mutates element, bumping `version`, `versionNonce`, and `updated`.
|
|
16
12
|
*
|
|
@@ -23,7 +19,7 @@ export declare const getDefaultStackProperties: () => _DucStackBase;
|
|
|
23
19
|
* This does not include base element properties like x, y, width, etc.,
|
|
24
20
|
* which are added during element creation.
|
|
25
21
|
*/
|
|
26
|
-
export declare const getDefaultTableData: (
|
|
22
|
+
export declare const getDefaultTableData: () => {
|
|
27
23
|
fileId: DucTableElement["fileId"];
|
|
28
24
|
gridConfig: DucTableElement["gridConfig"];
|
|
29
25
|
};
|
|
@@ -5,14 +5,10 @@ export * from "./newElement";
|
|
|
5
5
|
export * from "./textElement";
|
|
6
6
|
import { getUpdatedTimestamp } from "..";
|
|
7
7
|
import { LINE_SPACING_TYPE } from "../../enums";
|
|
8
|
-
import { getPrecisionValueFromRaw } from "../../technical/scopes";
|
|
9
8
|
import { isFreeDrawElement, isLinearElement } from "../../types/elements/typeChecks";
|
|
10
9
|
import { DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_TEXT_ALIGN, DEFAULT_VERTICAL_ALIGN } from "../constants";
|
|
11
10
|
import { randomInteger } from "../math/random";
|
|
12
|
-
|
|
13
|
-
* Returns a default DucTextStyle object for the given scope.
|
|
14
|
-
*/
|
|
15
|
-
export function getDefaultTextStyle(currentScope) {
|
|
11
|
+
export function getDefaultTextStyle() {
|
|
16
12
|
return {
|
|
17
13
|
isLtr: true,
|
|
18
14
|
fontFamily: DEFAULT_FONT_FAMILY,
|
|
@@ -22,7 +18,7 @@ export function getDefaultTextStyle(currentScope) {
|
|
|
22
18
|
lineHeight: 1.2,
|
|
23
19
|
lineSpacing: { type: LINE_SPACING_TYPE.MULTIPLE, value: 1.2 },
|
|
24
20
|
obliqueAngle: 0,
|
|
25
|
-
fontSize:
|
|
21
|
+
fontSize: DEFAULT_FONT_SIZE,
|
|
26
22
|
widthFactor: 1,
|
|
27
23
|
isUpsideDown: false,
|
|
28
24
|
isBackwards: false,
|
|
@@ -55,7 +51,7 @@ export const getDefaultStackProperties = () => {
|
|
|
55
51
|
* This does not include base element properties like x, y, width, etc.,
|
|
56
52
|
* which are added during element creation.
|
|
57
53
|
*/
|
|
58
|
-
export const getDefaultTableData = (
|
|
54
|
+
export const getDefaultTableData = () => {
|
|
59
55
|
return {
|
|
60
56
|
fileId: null,
|
|
61
57
|
gridConfig: {
|
|
@@ -71,7 +67,6 @@ export const getBaseElementProps = (element) => {
|
|
|
71
67
|
return {
|
|
72
68
|
x: element.x,
|
|
73
69
|
y: element.y,
|
|
74
|
-
scope: element.scope,
|
|
75
70
|
label: element.label,
|
|
76
71
|
isVisible: element.isVisible,
|
|
77
72
|
isPlot: element.isPlot,
|
|
@@ -114,7 +109,7 @@ export const isInvisiblySmallElement = (element) => {
|
|
|
114
109
|
if (isLinearElement(element) || isFreeDrawElement(element)) {
|
|
115
110
|
return element.points.length < 2;
|
|
116
111
|
}
|
|
117
|
-
return element.width
|
|
112
|
+
return element.width === 0 && element.height === 0;
|
|
118
113
|
};
|
|
119
114
|
/**
|
|
120
115
|
* Sorts a list of DucElements by their z-index (lowest first).
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PrecisionValue, RawValue, Scope } from "../../types";
|
|
2
1
|
import type { DucLine, DucLinearElement, DucLinearLikeElement, DucPoint, DucTextElementWithContainer, ElementsMap, NonDeleted } from "../../types/elements";
|
|
3
2
|
import { Bounds, GeometricPoint } from "../../types/geometry.types";
|
|
4
3
|
import type { ValueOf } from "../../types/utility.types";
|
|
@@ -15,7 +14,7 @@ export type HandleInfo = {
|
|
|
15
14
|
* Merges overlapping points using the line-based system
|
|
16
15
|
* Returns updated points and lines arrays
|
|
17
16
|
*/
|
|
18
|
-
export declare const mergeOverlappingPoints: (points: DucPoint[], lines: DucLine[], threshold?:
|
|
17
|
+
export declare const mergeOverlappingPoints: (points: DucPoint[], lines: DucLine[], threshold?: number) => {
|
|
19
18
|
points: DucPoint[];
|
|
20
19
|
lines: DucLine[];
|
|
21
20
|
};
|
|
@@ -27,23 +26,22 @@ export declare const mergeOverlappingPoints: (points: DucPoint[], lines: DucLine
|
|
|
27
26
|
export declare const getNormalizedPoints: (element: DucLinearElement | {
|
|
28
27
|
points: DucPoint[];
|
|
29
28
|
lines: DucLine[];
|
|
30
|
-
x:
|
|
31
|
-
y:
|
|
32
|
-
|
|
33
|
-
}, currentScope: Scope) => {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}) => {
|
|
34
32
|
points: DucPoint[];
|
|
35
33
|
lines: DucLine[];
|
|
36
|
-
x:
|
|
37
|
-
y:
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
38
36
|
};
|
|
39
37
|
/** scene coords */
|
|
40
|
-
export declare const getPointsGlobalCoordinates: (element: DucLinearLikeElement, elementsMap: ElementsMap
|
|
38
|
+
export declare const getPointsGlobalCoordinates: (element: DucLinearLikeElement, elementsMap: ElementsMap) => DucPoint[];
|
|
41
39
|
/** scene coords */
|
|
42
|
-
export declare const getPointGlobalCoordinates: (element: DucLinearLikeElement, point: GeometricPoint, elementsMap: ElementsMap
|
|
43
|
-
export declare const getBoundTextElementPosition: (element: DucLinearLikeElement, boundTextElement: DucTextElementWithContainer, elementsMap: ElementsMap
|
|
44
|
-
export declare const getLinearElementAbsoluteCoords: (element: DucLinearElement, elementsMap: ElementsMap, includeBoundText
|
|
45
|
-
export declare const getMinMaxXYWithBoundText: (element: DucLinearElement, elementsMap: ElementsMap, elementBounds: Bounds, boundTextElement: DucTextElementWithContainer
|
|
46
|
-
export declare const getSegmentMidPoint: (element: NonDeleted<DucLinearLikeElement>, startPoint: GeometricPoint, endPoint: GeometricPoint, endPointIndex: number, elementsMap: ElementsMap
|
|
40
|
+
export declare const getPointGlobalCoordinates: (element: DucLinearLikeElement, point: GeometricPoint, elementsMap: ElementsMap) => GeometricPoint;
|
|
41
|
+
export declare const getBoundTextElementPosition: (element: DucLinearLikeElement, boundTextElement: DucTextElementWithContainer, elementsMap: ElementsMap) => GeometricPoint | null;
|
|
42
|
+
export declare const getLinearElementAbsoluteCoords: (element: DucLinearElement, elementsMap: ElementsMap, includeBoundText?: boolean, returnUnrotatedBoundsOnly?: boolean) => ElementAbsoluteCoords;
|
|
43
|
+
export declare const getMinMaxXYWithBoundText: (element: DucLinearElement, elementsMap: ElementsMap, elementBounds: Bounds, boundTextElement: DucTextElementWithContainer) => ElementAbsoluteCoords;
|
|
44
|
+
export declare const getSegmentMidPoint: (element: NonDeleted<DucLinearLikeElement>, startPoint: GeometricPoint, endPoint: GeometricPoint, endPointIndex: number, elementsMap: ElementsMap) => GeometricPoint;
|
|
47
45
|
/**
|
|
48
46
|
* Validates if the given line indices form a closed path in the element
|
|
49
47
|
* @param element The linear element containing the points and lines
|