@vertexvis/viewer 0.10.2-canary.7 → 0.11.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/cjs/{browser.esm-ae55f058.js → browser.esm-17419694.js} +25 -25
- package/dist/cjs/{bundle.esm-c457ad4d.js → bundle.esm-b79513ef.js} +231 -207
- package/dist/cjs/{constants-4277684a.js → constants-1d65ed39.js} +1 -1
- package/dist/cjs/{cursors-b93b43ef.js → cursors-8aaf500f.js} +1 -1
- package/dist/cjs/{dom-cdb50ebc.js → dom-40804039.js} +1 -1
- package/dist/cjs/index.cjs.js +8 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{markup-3dac4cef.js → markup-e84a143f.js} +11 -2
- package/dist/cjs/{measurement-b494bf55.js → measurement-4579193b.js} +2 -2
- package/dist/cjs/{orientation-42cc9e8d.js → orientation-09d0f3ef.js} +14 -7
- package/dist/cjs/{png-decoder-2add73dd.js → png-decoder-97ea96ba.js} +3 -3
- package/dist/cjs/{scene-23a0a330.js → scene-4397373a.js} +28524 -2446
- package/dist/cjs/{utils-6933381f.js → utils-414e6cfe.js} +2 -2
- package/dist/cjs/utils-440f0f7d.js +61 -0
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +6 -5
- package/dist/cjs/vertex-viewer-dom-element_3.cjs.entry.js +4 -4
- package/dist/cjs/{vertex-viewer-markup-arrow_2.cjs.entry.js → vertex-viewer-markup-arrow_3.cjs.entry.js} +267 -4
- package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js +43 -9
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js +25 -5
- package/dist/cjs/vertex-viewer-measurement-distance_2.cjs.entry.js +8 -8
- package/dist/cjs/vertex-viewer-measurement-tool.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-measurements.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer.cjs.entry.js +141 -48
- package/dist/cjs/viewer.cjs.js +1 -1
- package/dist/cjs/{viewport-e69f8223.js → viewport-fc405a48.js} +31 -7
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/scene-tree/scene-tree.js +3 -2
- package/dist/collection/components/viewer/viewer.js +28 -3
- package/dist/collection/components/viewer-markup/utils.js +65 -1
- package/dist/collection/components/viewer-markup/viewer-markup.js +72 -16
- package/dist/collection/components/viewer-markup-circle/utils.js +2 -55
- package/dist/collection/components/viewer-markup-circle/viewer-markup-circle.js +4 -4
- package/dist/collection/components/viewer-markup-freeform.tsx/utils.js +10 -0
- package/dist/collection/components/viewer-markup-freeform.tsx/viewer-markup-freeform.css +157 -0
- package/dist/collection/components/viewer-markup-freeform.tsx/viewer-markup-freeform.js +413 -0
- package/dist/collection/components/viewer-markup-tool/viewer-markup-tool.js +63 -9
- package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance-components.js +1 -1
- package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance.js +2 -2
- package/dist/collection/lib/cursors.js +1 -1
- package/dist/collection/lib/interactions/baseInteractionHandler.js +5 -4
- package/dist/collection/lib/interactions/flyToPartKeyInteraction.js +1 -1
- package/dist/collection/lib/interactions/interactionApi.js +101 -22
- package/dist/collection/lib/interactions/mouseInteractions.js +17 -15
- package/dist/collection/lib/interactions/multiTouchInteractionHandler.js +2 -2
- package/dist/collection/lib/mappers.js +4 -3
- package/dist/collection/lib/scenes/camera.js +8 -2
- package/dist/collection/lib/scenes/operations.js +1 -1
- package/dist/collection/lib/scenes/scene.js +5 -2
- package/dist/collection/lib/types/frame.js +8 -2
- package/dist/collection/lib/types/markup.js +9 -1
- package/dist/collection/lib/types/stencilBuffer.js +2 -2
- package/dist/collection/lib/types/viewport.js +32 -8
- package/dist/collection/testing/fixtures.js +2 -1
- package/dist/esm/{browser.esm-7dbdf78a.js → browser.esm-e4fb17dc.js} +25 -25
- package/dist/esm/{bundle.esm-590d2273.js → bundle.esm-d891316f.js} +232 -208
- package/dist/esm/{constants-083f6b2c.js → constants-037e417f.js} +1 -1
- package/dist/esm/{cursors-39294365.js → cursors-00835249.js} +1 -1
- package/dist/esm/{dom-43682375.js → dom-d0877f90.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loader.mjs +1 -1
- package/dist/esm/{markup-3ce3dccd.js → markup-9b29aa94.js} +11 -3
- package/dist/esm/{measurement-78bd27fc.js → measurement-8430d5d6.js} +2 -2
- package/dist/esm/{orientation-c3e2af18.js → orientation-bb34b652.js} +14 -7
- package/dist/esm/{png-decoder-dfb97536.js → png-decoder-c4745070.js} +3 -3
- package/dist/esm/{scene-30ac6229.js → scene-72760305.js} +28532 -2454
- package/dist/esm/utils-5fe43b8a.js +52 -0
- package/dist/esm/{utils-b857bd7c.js → utils-f8e0baf7.js} +2 -2
- package/dist/esm/vertex-scene-tree.entry.js +6 -5
- package/dist/esm/vertex-viewer-dom-element_3.entry.js +4 -4
- package/dist/esm/{vertex-viewer-markup-arrow_2.entry.js → vertex-viewer-markup-arrow_3.entry.js} +267 -5
- package/dist/esm/vertex-viewer-markup-tool.entry.js +43 -9
- package/dist/esm/vertex-viewer-markup.entry.js +25 -5
- package/dist/esm/vertex-viewer-measurement-distance_2.entry.js +8 -8
- package/dist/esm/vertex-viewer-measurement-tool.entry.js +5 -5
- package/dist/esm/vertex-viewer-measurements.entry.js +5 -5
- package/dist/esm/vertex-viewer-view-cube.entry.js +3 -3
- package/dist/esm/vertex-viewer.entry.js +141 -48
- package/dist/esm/viewer.js +1 -1
- package/dist/esm/{viewport-8fea0743.js → viewport-d6f5cd7b.js} +31 -7
- package/dist/types/components/viewer/viewer.d.ts +4 -0
- package/dist/types/components/viewer-markup/utils.d.ts +8 -0
- package/dist/types/components/viewer-markup/viewer-markup.d.ts +13 -6
- package/dist/types/components/viewer-markup-circle/utils.d.ts +1 -4
- package/dist/types/components/viewer-markup-freeform.tsx/utils.d.ts +3 -0
- package/dist/types/components/viewer-markup-freeform.tsx/viewer-markup-freeform.d.ts +116 -0
- package/dist/types/components/viewer-markup-tool/viewer-markup-tool.d.ts +13 -1
- package/dist/types/components.d.ts +107 -10
- package/dist/types/lib/interactions/interactionApi.d.ts +22 -6
- package/dist/types/lib/interactions/mouseInteractions.d.ts +7 -6
- package/dist/types/lib/scenes/camera.d.ts +5 -1
- package/dist/types/lib/scenes/scene.d.ts +1 -1
- package/dist/types/lib/types/frame.d.ts +4 -1
- package/dist/types/lib/types/markup.d.ts +12 -1
- package/dist/types/lib/types/viewport.d.ts +17 -0
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/p-012fb54f.js +4 -0
- package/dist/viewer/{p-3dc15d99.entry.js → p-117324c0.entry.js} +1 -1
- package/dist/viewer/{p-1ee75110.entry.js → p-1c772ec1.entry.js} +1 -1
- package/dist/viewer/p-1f8a238b.js +4 -0
- package/dist/viewer/p-21e8510d.js +4 -0
- package/dist/viewer/{p-e3105f9a.entry.js → p-3c2aff67.entry.js} +1 -1
- package/dist/viewer/p-5389e9d4.js +4 -0
- package/dist/viewer/p-59d075d4.js +17 -0
- package/dist/viewer/{p-5b078339.js → p-62c6f482.js} +1 -1
- package/dist/viewer/p-640cb5f8.js +18 -0
- package/dist/viewer/p-68aaf1f8.entry.js +4 -0
- package/dist/viewer/{p-05b2444e.js → p-75682963.js} +1 -1
- package/dist/viewer/{p-4183c421.entry.js → p-79c45c02.entry.js} +1 -1
- package/dist/viewer/p-835e158e.js +4 -0
- package/dist/viewer/p-8c255868.entry.js +4 -0
- package/dist/viewer/{p-f4a492e1.js → p-9faabd97.js} +1 -1
- package/dist/viewer/p-b122ee39.js +4 -0
- package/dist/viewer/p-b36b3d1a.js +4 -0
- package/dist/viewer/{p-7c71db57.entry.js → p-bc9e6919.entry.js} +1 -1
- package/dist/viewer/{p-f090a3f3.entry.js → p-c818c80e.entry.js} +1 -1
- package/dist/viewer/{p-e96bc9a2.js → p-d42a482c.js} +1 -1
- package/dist/viewer/p-f43e8cc2.entry.js +4 -0
- package/dist/viewer/p-f75436be.entry.js +4 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +18 -16
- package/readme.md +6 -6
- package/dist/cjs/utils-96f244e1.js +0 -104
- package/dist/esm/utils-a550c58f.js +0 -96
- package/dist/viewer/p-11bdd2c4.js +0 -4
- package/dist/viewer/p-14182324.entry.js +0 -4
- package/dist/viewer/p-2768474e.js +0 -4
- package/dist/viewer/p-2e11803d.js +0 -4
- package/dist/viewer/p-6d4ab5fc.js +0 -17
- package/dist/viewer/p-964642c6.js +0 -4
- package/dist/viewer/p-9e856d0a.entry.js +0 -4
- package/dist/viewer/p-a717d9ff.js +0 -4
- package/dist/viewer/p-a9434d8e.entry.js +0 -4
- package/dist/viewer/p-af806858.js +0 -4
- package/dist/viewer/p-b5c350a7.js +0 -4
- package/dist/viewer/p-d912dd24.js +0 -18
- package/dist/viewer/p-f6d75616.entry.js +0 -4
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
const browser_esm = require('./browser.esm-
|
|
7
|
-
require('./orientation-
|
|
6
|
+
const browser_esm = require('./browser.esm-17419694.js');
|
|
7
|
+
require('./orientation-09d0f3ef.js');
|
|
8
8
|
|
|
9
9
|
const defaultFlags = {
|
|
10
10
|
throttleFrameDelivery: true,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2021 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const bundle_esm = require('./bundle.esm-b79513ef.js');
|
|
7
|
+
|
|
8
|
+
function createArrowheadPoints(start, end, arrowAngle = 60) {
|
|
9
|
+
const distance = bundle_esm.point.distance(start, end);
|
|
10
|
+
const angle = bundle_esm.angle.normalize(bundle_esm.angle.toDegrees(bundle_esm.angle.fromPoints(start, end)) - 270);
|
|
11
|
+
// Adjust the arrow height in relation to the distance between the to and from
|
|
12
|
+
// points. Uses a min and max size so the arrow doesn't become cartoonish.
|
|
13
|
+
const height = Math.max(4, Math.min(16, distance * 0.25));
|
|
14
|
+
const sideLength = height / Math.cos(bundle_esm.angle.toRadians(90 - arrowAngle));
|
|
15
|
+
const rotation = bundle_esm.matrix.rotation(angle);
|
|
16
|
+
const arrowLeft = bundle_esm.point.polar(sideLength, bundle_esm.angle.toRadians(arrowAngle * 2));
|
|
17
|
+
const arrowRight = bundle_esm.point.polar(sideLength, bundle_esm.angle.toRadians(arrowAngle));
|
|
18
|
+
const arrowBase = bundle_esm.point.polar(height, bundle_esm.angle.toRadians(90));
|
|
19
|
+
return {
|
|
20
|
+
tip: end,
|
|
21
|
+
left: bundle_esm.point.add(end, bundle_esm.matrix.transformPoint(rotation, arrowLeft)),
|
|
22
|
+
right: bundle_esm.point.add(end, bundle_esm.matrix.transformPoint(rotation, arrowRight)),
|
|
23
|
+
base: bundle_esm.point.add(end, bundle_esm.matrix.transformPoint(rotation, arrowBase)),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function arrowheadPointsToPolygonPoints(points) {
|
|
27
|
+
return [points.tip, points.right, points.base, points.left]
|
|
28
|
+
.map((pt) => `${pt.x},${pt.y}`)
|
|
29
|
+
.join(' ');
|
|
30
|
+
}
|
|
31
|
+
function isVertexViewerArrowMarkup(el) {
|
|
32
|
+
return (el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-ARROW');
|
|
33
|
+
}
|
|
34
|
+
function parsePoint(value) {
|
|
35
|
+
return typeof value === 'string' ? bundle_esm.point.fromJson(value) : value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isVertexViewerCircleMarkup(el) {
|
|
39
|
+
return (el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-CIRCLE');
|
|
40
|
+
}
|
|
41
|
+
function parseBounds(value) {
|
|
42
|
+
return typeof value === 'string' ? bundle_esm.rectangle.fromJson(value) : value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function parsePoints(value) {
|
|
46
|
+
return typeof value === 'string'
|
|
47
|
+
? JSON.parse(value).map((values) => bundle_esm.point.fromJson(JSON.stringify(values)))
|
|
48
|
+
: value;
|
|
49
|
+
}
|
|
50
|
+
function isVertexViewerFreeformMarkup(el) {
|
|
51
|
+
return (el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-FREEFORM');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
exports.arrowheadPointsToPolygonPoints = arrowheadPointsToPolygonPoints;
|
|
55
|
+
exports.createArrowheadPoints = createArrowheadPoints;
|
|
56
|
+
exports.isVertexViewerArrowMarkup = isVertexViewerArrowMarkup;
|
|
57
|
+
exports.isVertexViewerCircleMarkup = isVertexViewerCircleMarkup;
|
|
58
|
+
exports.isVertexViewerFreeformMarkup = isVertexViewerFreeformMarkup;
|
|
59
|
+
exports.parseBounds = parseBounds;
|
|
60
|
+
exports.parsePoint = parsePoint;
|
|
61
|
+
exports.parsePoints = parsePoints;
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
|
-
const bundle_esm = require('./bundle.esm-
|
|
9
|
+
const bundle_esm = require('./bundle.esm-b79513ef.js');
|
|
10
10
|
const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
|
|
11
|
-
const browser_esm = require('./browser.esm-
|
|
12
|
-
const utils = require('./utils-
|
|
11
|
+
const browser_esm = require('./browser.esm-17419694.js');
|
|
12
|
+
const utils = require('./utils-414e6cfe.js');
|
|
13
13
|
const stencil = require('./stencil-60732441.js');
|
|
14
|
-
require('./orientation-
|
|
14
|
+
require('./orientation-09d0f3ef.js');
|
|
15
15
|
|
|
16
16
|
window.requestIdleCallback =
|
|
17
17
|
window.requestIdleCallback ||
|
|
@@ -9396,7 +9396,8 @@ const SceneTree = class {
|
|
|
9396
9396
|
(_a = this.stateMap.viewerDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
9397
9397
|
}
|
|
9398
9398
|
if (newViewer != null) {
|
|
9399
|
-
this.stateMap.viewerDisposable =
|
|
9399
|
+
this.stateMap.viewerDisposable =
|
|
9400
|
+
(_b = this.controller) === null || _b === void 0 ? void 0 : _b.connectToViewer(newViewer);
|
|
9400
9401
|
}
|
|
9401
9402
|
}
|
|
9402
9403
|
/**
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
|
-
const bundle_esm = require('./bundle.esm-
|
|
10
|
-
require('./orientation-
|
|
11
|
-
const viewport = require('./viewport-
|
|
12
|
-
require('./browser.esm-
|
|
9
|
+
const bundle_esm = require('./bundle.esm-b79513ef.js');
|
|
10
|
+
require('./orientation-09d0f3ef.js');
|
|
11
|
+
const viewport = require('./viewport-fc405a48.js');
|
|
12
|
+
require('./browser.esm-17419694.js');
|
|
13
13
|
|
|
14
14
|
const viewerDomElementCss = ":host{position:absolute;pointer-events:none}:host(:not([interactions-off]))>*{pointer-events:auto}";
|
|
15
15
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
|
-
const bundle_esm = require('./bundle.esm-
|
|
10
|
-
const dom = require('./dom-
|
|
11
|
-
const utils = require('./utils-
|
|
9
|
+
const bundle_esm = require('./bundle.esm-b79513ef.js');
|
|
10
|
+
const dom = require('./dom-40804039.js');
|
|
11
|
+
const utils = require('./utils-440f0f7d.js');
|
|
12
12
|
const index$1 = require('./index-3bc6bac0.js');
|
|
13
13
|
require('./_commonjsHelpers-537d719a.js');
|
|
14
14
|
|
|
@@ -119,6 +119,66 @@ function translatePointToRelative(pt, canvasDimensions) {
|
|
|
119
119
|
const scaleFactor = toRelativeScaleFactor(canvasDimensions);
|
|
120
120
|
return bundle_esm.point.scale(bundle_esm.point.subtract(pt, bundle_esm.dimensions.center(canvasDimensions)), scaleFactor, scaleFactor);
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Translates a set of points in relative `original` units to
|
|
124
|
+
* points in relative `bounds` units.
|
|
125
|
+
*/
|
|
126
|
+
function translatePointsToBounds(points, original, bounds) {
|
|
127
|
+
return points.map((pt) => bundle_esm.point.add(bundle_esm.point.scale(bundle_esm.point.subtract(pt, original), bounds.width / (original.width || 1), bounds.height / (original.height || 1)), bounds));
|
|
128
|
+
}
|
|
129
|
+
function createRectangle(initialPoint, currentPoint, maintainAspectRatio) {
|
|
130
|
+
const bounds = bundle_esm.rectangle.fromPoints(initialPoint, currentPoint);
|
|
131
|
+
if (maintainAspectRatio) {
|
|
132
|
+
const fitBoundsSize = Math.max(bounds.width, bounds.height);
|
|
133
|
+
const isPortrait = bounds.height > bounds.width;
|
|
134
|
+
const currentIsLeftOfInitial = currentPoint.x <= initialPoint.x;
|
|
135
|
+
const currentIsAboveInitial = currentPoint.y <= initialPoint.y;
|
|
136
|
+
const fitBoundsX = currentIsLeftOfInitial
|
|
137
|
+
? isPortrait
|
|
138
|
+
? initialPoint.x - fitBoundsSize
|
|
139
|
+
: currentPoint.x
|
|
140
|
+
: initialPoint.x;
|
|
141
|
+
const fitBoundsY = currentIsAboveInitial
|
|
142
|
+
? isPortrait
|
|
143
|
+
? currentPoint.y
|
|
144
|
+
: initialPoint.y - fitBoundsSize
|
|
145
|
+
: initialPoint.y;
|
|
146
|
+
return bundle_esm.rectangle.create(fitBoundsX, fitBoundsY, fitBoundsSize, fitBoundsSize);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return bounds;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function transformRectangle(bounds, start, current, anchor, maintainAspectRatio) {
|
|
153
|
+
const delta = bundle_esm.point.subtract(current, start);
|
|
154
|
+
const { x: left, y: top, width: w, height: h } = bounds;
|
|
155
|
+
const right = left + w;
|
|
156
|
+
const bottom = top + h;
|
|
157
|
+
const topLeft = bundle_esm.point.create(left, top);
|
|
158
|
+
const bottomLeft = bundle_esm.point.create(left, bottom);
|
|
159
|
+
const topRight = bundle_esm.point.create(right, top);
|
|
160
|
+
const bottomRight = bundle_esm.point.create(right, bottom);
|
|
161
|
+
switch (anchor) {
|
|
162
|
+
case 'top-left':
|
|
163
|
+
return createRectangle(bottomRight, current, !!maintainAspectRatio);
|
|
164
|
+
case 'top':
|
|
165
|
+
return createRectangle(bottomRight, bundle_esm.point.create(left, current.y), !!maintainAspectRatio);
|
|
166
|
+
case 'top-right':
|
|
167
|
+
return createRectangle(bottomLeft, current, !!maintainAspectRatio);
|
|
168
|
+
case 'right':
|
|
169
|
+
return createRectangle(bottomLeft, bundle_esm.point.create(current.x, top), !!maintainAspectRatio);
|
|
170
|
+
case 'bottom-right':
|
|
171
|
+
return createRectangle(topLeft, current, !!maintainAspectRatio);
|
|
172
|
+
case 'bottom':
|
|
173
|
+
return createRectangle(topLeft, bundle_esm.point.create(right, current.y), !!maintainAspectRatio);
|
|
174
|
+
case 'bottom-left':
|
|
175
|
+
return createRectangle(topRight, current, !!maintainAspectRatio);
|
|
176
|
+
case 'left':
|
|
177
|
+
return createRectangle(bottomRight, bundle_esm.point.create(current.x, top), !!maintainAspectRatio);
|
|
178
|
+
case 'center':
|
|
179
|
+
return bundle_esm.rectangle.create(bounds.x + delta.x, bounds.y + delta.y, bounds.width, bounds.height);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
122
182
|
|
|
123
183
|
function getMarkupBoundingClientRect(element) {
|
|
124
184
|
return element.getBoundingClientRect();
|
|
@@ -334,7 +394,7 @@ const ViewerMarkupCircle = class {
|
|
|
334
394
|
this.startPosition != null &&
|
|
335
395
|
this.elementBounds != null) {
|
|
336
396
|
const position = translatePointToRelative(dom.getMouseClientPosition(event, this.elementBounds), this.elementBounds);
|
|
337
|
-
this.bounds =
|
|
397
|
+
this.bounds = transformRectangle((_a = this.resizeBounds) !== null && _a !== void 0 ? _a : this.bounds, this.startPosition, position, this.editAnchor, event.shiftKey);
|
|
338
398
|
}
|
|
339
399
|
};
|
|
340
400
|
this.startMarkup = (event) => {
|
|
@@ -444,5 +504,208 @@ const ViewerMarkupCircle = class {
|
|
|
444
504
|
};
|
|
445
505
|
ViewerMarkupCircle.style = viewerMarkupCircleCss;
|
|
446
506
|
|
|
507
|
+
const viewerMarkupFreeformCss = ":host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-markup-freeform-stroke-color:var(--red-800);--viewer-markup-freeform-stroke-width:4;--viewer-markup-freeform-line-join:round;--viewer-markup-freeform-line-cap:round;--viewer-markup-freeform-bounds-outline-border-color:var(--blue-400);--viewer-markup-freeform-bounds-outline-border-width:1px;--viewer-markup-freeform-bounds-edge-anchor-border-color:var(--blue-400);--viewer-markup-freeform-bounds-edge-anchor-border-width:1px;--viewer-markup-freeform-bounds-edge-anchor-background-color:white;--viewer-markup-freeform-bounds-center-anchor-border-color:white;--viewer-markup-freeform-bounds-center-anchor-border-width:1px;--viewer-markup-freeform-bounds-center-anchor-background-color:var(--blue-400);--viewer-markup-freeform-bounds-anchor-width:9px;--viewer-markup-freeform-bounds-anchor-height:9px}.svg{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.path{pointer-events:auto;cursor:default;stroke:var(--viewer-markup-freeform-stroke-color);stroke-width:var(--viewer-markup-freeform-stroke-width);stroke-linejoin:var(--viewer-markup-freeform-line-join);stroke-linecap:var(--viewer-markup-freeform-line-cap)}.create-overlay{pointer-events:auto;position:absolute;left:0;top:0;width:100%;height:100%;cursor:crosshair}.bounds-container{pointer-events:none;position:absolute;width:100%;height:100%;top:0;left:0;overflow:hidden}.bounds-outline{position:absolute;border-width:var(--viewer-markup-freeform-bounds-outline-border-width);border-color:var(--viewer-markup-freeform-bounds-outline-border-color);border-style:solid;box-shadow:0 0 3px rgba(0, 0, 0, 0.3)}.bounds-anchor-position{position:absolute;transform:translate(-50%, -50%)}.bounds-anchor{pointer-events:auto;cursor:default;user-select:none}.bounds-default-anchor{width:var(--viewer-markup-freeform-bounds-anchor-width);height:var(--viewer-markup-freeform-bounds-anchor-height);box-sizing:border-box;box-shadow:0 0 2px rgba(0, 0, 0, 0.3)}.bounds-center-anchor{border-radius:100%;border-width:var(--viewer-markup-freeform-bounds-center-anchor-border-width);border-color:var(--viewer-markup-freeform-bounds-center-anchor-border-color);border-style:solid;background-color:var(--viewer-markup-freeform-bounds-center-anchor-background-color)}.bounds-edge-anchor{border-width:var(--viewer-markup-freeform-bounds-edge-anchor-border-width);border-color:var(--viewer-markup-freeform-bounds-edge-anchor-border-color);border-style:solid;background-color:var(--viewer-markup-freeform-bounds-edge-anchor-background-color)}";
|
|
508
|
+
|
|
509
|
+
const ViewerMarkupFreeform = class {
|
|
510
|
+
constructor(hostRef) {
|
|
511
|
+
index.registerInstance(this, hostRef);
|
|
512
|
+
this.editBegin = index.createEvent(this, "editBegin", 7);
|
|
513
|
+
this.editEnd = index.createEvent(this, "editEnd", 7);
|
|
514
|
+
this.editCancel = index.createEvent(this, "editCancel", 7);
|
|
515
|
+
/**
|
|
516
|
+
* A mode that specifies how the markup component should behave. When
|
|
517
|
+
* unset, the component will not respond to interactions with the handles.
|
|
518
|
+
* When `edit`, the markup anchors are interactive and the user is able
|
|
519
|
+
* to reposition them. When `create`, anytime the user clicks on the canvas,
|
|
520
|
+
* a new markup will be performed.
|
|
521
|
+
*/
|
|
522
|
+
this.mode = '';
|
|
523
|
+
this.editAnchor = 'bottom-right';
|
|
524
|
+
this.screenPoints = [];
|
|
525
|
+
this.updateEditAnchor = (event, anchor) => {
|
|
526
|
+
if (this.elementBounds != null) {
|
|
527
|
+
this.resizeBounds = this.bounds;
|
|
528
|
+
this.resizePoints = this.points;
|
|
529
|
+
this.editAnchor = anchor;
|
|
530
|
+
this.resizeStartPosition = translatePointToRelative(dom.getMouseClientPosition(event, this.elementBounds), this.elementBounds);
|
|
531
|
+
this.addEditingInteractionListeners();
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
this.updateBounds = (event) => {
|
|
535
|
+
var _a;
|
|
536
|
+
if (this.resizeStartPosition != null &&
|
|
537
|
+
this.elementBounds != null &&
|
|
538
|
+
this.resizeBounds != null &&
|
|
539
|
+
this.resizePoints != null) {
|
|
540
|
+
const position = translatePointToRelative(dom.getMouseClientPosition(event, this.elementBounds), this.elementBounds);
|
|
541
|
+
const updatedBounds = transformRectangle(this.resizeBounds, this.resizeStartPosition, position, this.editAnchor, event.shiftKey);
|
|
542
|
+
this.points = translatePointsToBounds(this.resizePoints, this.resizeBounds, updatedBounds);
|
|
543
|
+
this.screenPoints = (_a = this.convertPointsToScreen()) !== null && _a !== void 0 ? _a : this.screenPoints;
|
|
544
|
+
this.bounds = updatedBounds;
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
this.updatePoints = (event) => {
|
|
548
|
+
if (this.points != null && this.elementBounds != null) {
|
|
549
|
+
const screenPosition = dom.getMouseClientPosition(event, this.elementBounds);
|
|
550
|
+
const position = translatePointToRelative(screenPosition, this.elementBounds);
|
|
551
|
+
this.updateMinAndMax(position);
|
|
552
|
+
this.points = [...this.points, position];
|
|
553
|
+
this.screenPoints = [...this.screenPoints, screenPosition];
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
this.startMarkup = (event) => {
|
|
557
|
+
var _a, _b;
|
|
558
|
+
if (this.mode !== '' && this.elementBounds != null) {
|
|
559
|
+
const screenPosition = dom.getMouseClientPosition(event, this.elementBounds);
|
|
560
|
+
const position = translatePointToRelative(screenPosition, this.elementBounds);
|
|
561
|
+
this.updateMinAndMax(position);
|
|
562
|
+
this.points = (_a = this.points) !== null && _a !== void 0 ? _a : [position];
|
|
563
|
+
this.screenPoints = (_b = this.screenPoints) !== null && _b !== void 0 ? _b : [screenPosition];
|
|
564
|
+
this.editBegin.emit();
|
|
565
|
+
this.addDrawingInteractionListeners();
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
this.endMarkup = (event) => {
|
|
569
|
+
if (this.mode !== '' &&
|
|
570
|
+
this.points != null &&
|
|
571
|
+
this.points.length > 1 &&
|
|
572
|
+
this.elementBounds != null) {
|
|
573
|
+
const screenPosition = dom.getMouseClientPosition(event, this.elementBounds);
|
|
574
|
+
const position = translatePointToRelative(screenPosition, this.elementBounds);
|
|
575
|
+
this.updateMinAndMax(position);
|
|
576
|
+
this.points = [...this.points, position];
|
|
577
|
+
this.screenPoints = [...this.screenPoints, screenPosition];
|
|
578
|
+
this.editEnd.emit();
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
this.points = undefined;
|
|
582
|
+
this.editCancel.emit();
|
|
583
|
+
}
|
|
584
|
+
this.min = undefined;
|
|
585
|
+
this.max = undefined;
|
|
586
|
+
this.removeDrawingInteractionListeners();
|
|
587
|
+
};
|
|
588
|
+
this.endEdit = () => {
|
|
589
|
+
this.resizeBounds = undefined;
|
|
590
|
+
this.removeEditingInteractionListeners();
|
|
591
|
+
this.editEnd.emit();
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* @ignore
|
|
596
|
+
*/
|
|
597
|
+
componentWillLoad() {
|
|
598
|
+
this.updateViewport();
|
|
599
|
+
this.handleViewerChanged(this.viewer);
|
|
600
|
+
this.updatePointsFromProps();
|
|
601
|
+
}
|
|
602
|
+
componentDidLoad() {
|
|
603
|
+
this.updatePointsFromProps();
|
|
604
|
+
const resize = new ResizeObserver(() => this.updateViewport());
|
|
605
|
+
resize.observe(this.hostEl);
|
|
606
|
+
}
|
|
607
|
+
async dispose() {
|
|
608
|
+
if (this.viewer != null) {
|
|
609
|
+
this.removeInteractionListeners(this.viewer);
|
|
610
|
+
}
|
|
611
|
+
this.removeDrawingInteractionListeners();
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* @ignore
|
|
615
|
+
*/
|
|
616
|
+
handleViewerChanged(newViewer, oldViewer) {
|
|
617
|
+
if (oldViewer != null) {
|
|
618
|
+
this.removeInteractionListeners(oldViewer);
|
|
619
|
+
}
|
|
620
|
+
if (newViewer != null) {
|
|
621
|
+
this.addInteractionListeners(newViewer);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
handlePointsJsonChange() {
|
|
625
|
+
this.updatePointsFromProps();
|
|
626
|
+
}
|
|
627
|
+
handleBoundsJsonChange() {
|
|
628
|
+
this.updatePointsFromProps();
|
|
629
|
+
}
|
|
630
|
+
updateViewport() {
|
|
631
|
+
var _a;
|
|
632
|
+
const rect = getMarkupBoundingClientRect(this.hostEl);
|
|
633
|
+
this.elementBounds = rect;
|
|
634
|
+
this.screenPoints = (_a = this.convertPointsToScreen()) !== null && _a !== void 0 ? _a : this.screenPoints;
|
|
635
|
+
}
|
|
636
|
+
updatePointsFromProps() {
|
|
637
|
+
var _a, _b, _c;
|
|
638
|
+
this.points = (_a = this.points) !== null && _a !== void 0 ? _a : utils.parsePoints(this.pointsJson);
|
|
639
|
+
this.screenPoints = (_b = this.convertPointsToScreen()) !== null && _b !== void 0 ? _b : [];
|
|
640
|
+
this.bounds = (_c = this.bounds) !== null && _c !== void 0 ? _c : utils.parseBounds(this.boundsJson);
|
|
641
|
+
}
|
|
642
|
+
render() {
|
|
643
|
+
if (this.screenPoints.length > 0 && this.elementBounds != null) {
|
|
644
|
+
return (index.h(index.Host, null, index.h("svg", { class: "svg" }, index.h("defs", null, index.h(SvgShadow, { id: "freeform-markup-shadow" })), index.h("g", { filter: "url(#freeform-markup-shadow)" }, index.h("path", { class: "path", d: this.screenPoints.reduce((d, pt) => `${d}L${pt.x},${pt.y}`, `M${this.screenPoints[0].x},${this.screenPoints[0].y}`), fill: "none" }))), this.mode === 'edit' && this.bounds != null && (index.h(BoundingBox2d, { bounds: translateRectToScreen(this.bounds, this.elementBounds), onTopLeftAnchorPointerDown: (e) => this.updateEditAnchor(e, 'top-left'), onTopRightAnchorPointerDown: (e) => this.updateEditAnchor(e, 'top-right'), onTopAnchorPointerDown: (e) => this.updateEditAnchor(e, 'top'), onBottomLeftAnchorPointerDown: (e) => this.updateEditAnchor(e, 'bottom-left'), onBottomRightAnchorPointerDown: (e) => this.updateEditAnchor(e, 'bottom-right'), onBottomAnchorPointerDown: (e) => this.updateEditAnchor(e, 'bottom'), onLeftAnchorPointerDown: (e) => this.updateEditAnchor(e, 'left'), onRightAnchorPointerDown: (e) => this.updateEditAnchor(e, 'right'), onCenterAnchorPointerDown: (e) => this.updateEditAnchor(e, 'center') }))));
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
return (index.h(index.Host, null, index.h("div", { class: "create-overlay", onPointerDown: (event) => this.startMarkup(event) })));
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
async addInteractionListeners(viewer) {
|
|
651
|
+
const interactionTarget = await viewer.getInteractionTarget();
|
|
652
|
+
if (this.mode === 'create') {
|
|
653
|
+
interactionTarget.addEventListener('pointerdown', this.startMarkup);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
async addDrawingInteractionListeners() {
|
|
657
|
+
if (this.mode !== '') {
|
|
658
|
+
window.addEventListener('pointermove', this.updatePoints);
|
|
659
|
+
window.addEventListener('pointerup', this.endMarkup);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
async addEditingInteractionListeners() {
|
|
663
|
+
if (this.mode === 'edit') {
|
|
664
|
+
window.addEventListener('pointermove', this.updateBounds);
|
|
665
|
+
window.addEventListener('pointerup', this.endEdit);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
async removeInteractionListeners(viewer) {
|
|
669
|
+
const interactionTarget = await viewer.getInteractionTarget();
|
|
670
|
+
interactionTarget.removeEventListener('pointerdown', this.startMarkup);
|
|
671
|
+
}
|
|
672
|
+
async removeDrawingInteractionListeners() {
|
|
673
|
+
window.removeEventListener('pointermove', this.updatePoints);
|
|
674
|
+
window.removeEventListener('pointerup', this.endMarkup);
|
|
675
|
+
}
|
|
676
|
+
async removeEditingInteractionListeners() {
|
|
677
|
+
if (this.mode === 'edit') {
|
|
678
|
+
window.removeEventListener('pointermove', this.updateBounds);
|
|
679
|
+
window.removeEventListener('pointerup', this.endEdit);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
updateMinAndMax(position) {
|
|
683
|
+
this.min =
|
|
684
|
+
this.min != null
|
|
685
|
+
? bundle_esm.point.create(Math.min(this.min.x, position.x), Math.min(this.min.y, position.y))
|
|
686
|
+
: position;
|
|
687
|
+
this.max =
|
|
688
|
+
this.max != null
|
|
689
|
+
? bundle_esm.point.create(Math.max(this.max.x, position.x), Math.max(this.max.y, position.y))
|
|
690
|
+
: position;
|
|
691
|
+
this.bounds = bundle_esm.rectangle.create(this.min.x, this.min.y, this.max.x - this.min.x, this.max.y - this.min.y);
|
|
692
|
+
}
|
|
693
|
+
convertPointsToScreen() {
|
|
694
|
+
var _a;
|
|
695
|
+
const elementBounds = this.elementBounds;
|
|
696
|
+
if (elementBounds != null) {
|
|
697
|
+
return (_a = this.points) === null || _a === void 0 ? void 0 : _a.map((pt) => translatePointToScreen(pt, elementBounds));
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
get hostEl() { return index.getElement(this); }
|
|
701
|
+
static get watchers() { return {
|
|
702
|
+
"viewer": ["handleViewerChanged"],
|
|
703
|
+
"points": ["handlePointsJsonChange"],
|
|
704
|
+
"bounds": ["handleBoundsJsonChange"]
|
|
705
|
+
}; }
|
|
706
|
+
};
|
|
707
|
+
ViewerMarkupFreeform.style = viewerMarkupFreeformCss;
|
|
708
|
+
|
|
447
709
|
exports.vertex_viewer_markup_arrow = ViewerMarkupArrow;
|
|
448
710
|
exports.vertex_viewer_markup_circle = ViewerMarkupCircle;
|
|
711
|
+
exports.vertex_viewer_markup_freeform = ViewerMarkupFreeform;
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
9
|
const templates = require('./templates-e57b3741.js');
|
|
10
|
-
const utils = require('./utils-
|
|
11
|
-
const markup = require('./markup-
|
|
12
|
-
require('./bundle.esm-
|
|
13
|
-
require('./browser.esm-
|
|
10
|
+
const utils = require('./utils-440f0f7d.js');
|
|
11
|
+
const markup = require('./markup-e84a143f.js');
|
|
12
|
+
require('./bundle.esm-b79513ef.js');
|
|
13
|
+
require('./browser.esm-17419694.js');
|
|
14
14
|
|
|
15
15
|
const viewerMarkupToolCss = ":host{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}";
|
|
16
16
|
|
|
@@ -44,7 +44,15 @@ const ViewerMarkupTool = class {
|
|
|
44
44
|
};
|
|
45
45
|
this.handleMarkupEditEnd = () => {
|
|
46
46
|
const { markupElement } = this.stateMap;
|
|
47
|
-
if (utils.
|
|
47
|
+
if (utils.isVertexViewerFreeformMarkup(markupElement)) {
|
|
48
|
+
const { points, bounds } = markupElement;
|
|
49
|
+
markupElement.points = undefined;
|
|
50
|
+
markupElement.bounds = undefined;
|
|
51
|
+
if (points != null && points.length > 0 && bounds != null) {
|
|
52
|
+
this.markupEnd.emit(new markup.FreeformMarkup({ points, bounds }));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else if (utils.isVertexViewerCircleMarkup(markupElement)) {
|
|
48
56
|
const { bounds } = markupElement;
|
|
49
57
|
markupElement.bounds = undefined;
|
|
50
58
|
if (bounds != null) {
|
|
@@ -88,6 +96,12 @@ const ViewerMarkupTool = class {
|
|
|
88
96
|
handleCircleTemplateIdChanged() {
|
|
89
97
|
this.updateMarkupElement();
|
|
90
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* @ignore
|
|
101
|
+
*/
|
|
102
|
+
handleFreeformTemplateIdChanged() {
|
|
103
|
+
this.updateMarkupElement();
|
|
104
|
+
}
|
|
91
105
|
/**
|
|
92
106
|
* @ignore
|
|
93
107
|
*/
|
|
@@ -105,7 +119,9 @@ const ViewerMarkupTool = class {
|
|
|
105
119
|
*/
|
|
106
120
|
render() {
|
|
107
121
|
if (!this.disabled) {
|
|
108
|
-
if (this.tool === 'arrow' ||
|
|
122
|
+
if (this.tool === 'arrow' ||
|
|
123
|
+
this.tool === 'circle' ||
|
|
124
|
+
this.tool === 'freeform') {
|
|
109
125
|
return (index.h(index.Host, null, index.h("slot", null)));
|
|
110
126
|
}
|
|
111
127
|
else {
|
|
@@ -134,6 +150,25 @@ const ViewerMarkupTool = class {
|
|
|
134
150
|
}
|
|
135
151
|
return document.createElement('vertex-viewer-markup-circle');
|
|
136
152
|
}
|
|
153
|
+
createFreeformMarkupElement() {
|
|
154
|
+
if (this.freeformTemplateId != null) {
|
|
155
|
+
const element = templates.stampTemplateWithId(window.document.body, this.freeformTemplateId, utils.isVertexViewerFreeformMarkup, () => console.warn(`Freeform template with ID ${this.freeformTemplateId} not found. Using default freeform element.`), () => console.warn(`Freeform template does not contain a vertex-viewer-markup-freeform. Using default freeform element.`));
|
|
156
|
+
if (element != null) {
|
|
157
|
+
return element;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return document.createElement('vertex-viewer-markup-freeform');
|
|
161
|
+
}
|
|
162
|
+
createNewMarkupElement() {
|
|
163
|
+
switch (this.tool) {
|
|
164
|
+
case 'arrow':
|
|
165
|
+
return this.createArrowMarkupElement();
|
|
166
|
+
case 'circle':
|
|
167
|
+
return this.createCircleMarkupElement();
|
|
168
|
+
case 'freeform':
|
|
169
|
+
return this.createFreeformMarkupElement();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
137
172
|
updateMarkupElement() {
|
|
138
173
|
const { markupElement } = this.stateMap;
|
|
139
174
|
if (markupElement != null) {
|
|
@@ -145,9 +180,7 @@ const ViewerMarkupTool = class {
|
|
|
145
180
|
markupElement.removeEventListener('editCancel', this.handleMarkupEditCancel);
|
|
146
181
|
}
|
|
147
182
|
if (!this.disabled) {
|
|
148
|
-
const newMarkupElement = this.
|
|
149
|
-
? this.createArrowMarkupElement()
|
|
150
|
-
: this.createCircleMarkupElement();
|
|
183
|
+
const newMarkupElement = this.createNewMarkupElement();
|
|
151
184
|
newMarkupElement.mode = 'create';
|
|
152
185
|
newMarkupElement.viewer = this.viewer;
|
|
153
186
|
newMarkupElement.addEventListener('editBegin', this.handleMarkupEditBegin);
|
|
@@ -163,6 +196,7 @@ const ViewerMarkupTool = class {
|
|
|
163
196
|
"tool": ["handleToolChanged"],
|
|
164
197
|
"arrowTemplateId": ["handleArrowTemplateIdChanged"],
|
|
165
198
|
"circleTemplateId": ["handleCircleTemplateIdChanged"],
|
|
199
|
+
"freeformTemplateId": ["handleFreeformTemplateIdChanged"],
|
|
166
200
|
"disabled": ["handleDisabledChanged"]
|
|
167
201
|
}; }
|
|
168
202
|
};
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
9
|
const templates = require('./templates-e57b3741.js');
|
|
10
|
-
const markup = require('./markup-
|
|
11
|
-
const utils = require('./utils-
|
|
12
|
-
require('./bundle.esm-
|
|
13
|
-
require('./browser.esm-
|
|
10
|
+
const markup = require('./markup-e84a143f.js');
|
|
11
|
+
const utils = require('./utils-440f0f7d.js');
|
|
12
|
+
require('./bundle.esm-b79513ef.js');
|
|
13
|
+
require('./browser.esm-17419694.js');
|
|
14
14
|
|
|
15
15
|
const viewerMarkupCss = ":host{display:block;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}";
|
|
16
16
|
|
|
@@ -56,6 +56,14 @@ const ViewerMarkup = class {
|
|
|
56
56
|
el.bounds = bounds;
|
|
57
57
|
return this.appendMarkupElement(el);
|
|
58
58
|
}
|
|
59
|
+
else if (markup$1 instanceof markup.FreeformMarkup) {
|
|
60
|
+
const { bounds, points, id } = markup$1;
|
|
61
|
+
const el = this.createFreeformMarkupElement();
|
|
62
|
+
el.id = id;
|
|
63
|
+
el.points = points;
|
|
64
|
+
el.bounds = bounds;
|
|
65
|
+
return this.appendMarkupElement(el);
|
|
66
|
+
}
|
|
59
67
|
else {
|
|
60
68
|
throw new Error(`Cannot add markup. Unknown type '${markup$1}'.`);
|
|
61
69
|
}
|
|
@@ -83,7 +91,9 @@ const ViewerMarkup = class {
|
|
|
83
91
|
* @see {@link ViewerMarkup.getMarkupElement}
|
|
84
92
|
*/
|
|
85
93
|
async getMarkupElements() {
|
|
86
|
-
return Array.from(this.hostEl.children).filter((e) => utils.isVertexViewerArrowMarkup(e) ||
|
|
94
|
+
return Array.from(this.hostEl.children).filter((e) => utils.isVertexViewerArrowMarkup(e) ||
|
|
95
|
+
utils.isVertexViewerCircleMarkup(e) ||
|
|
96
|
+
utils.isVertexViewerFreeformMarkup(e));
|
|
87
97
|
}
|
|
88
98
|
/**
|
|
89
99
|
* Returns the markup element associated to the given ID.
|
|
@@ -199,6 +209,15 @@ const ViewerMarkup = class {
|
|
|
199
209
|
}
|
|
200
210
|
return document.createElement('vertex-viewer-markup-circle');
|
|
201
211
|
}
|
|
212
|
+
createFreeformMarkupElement() {
|
|
213
|
+
if (this.freeformTemplateId != null) {
|
|
214
|
+
const element = templates.stampTemplateWithId(window.document.body, this.freeformTemplateId, utils.isVertexViewerFreeformMarkup, () => console.warn(`Freeform template with ID ${this.freeformTemplateId} not found. Using default freeform element.`), () => console.warn(`Freeform template does not contain a vertex-viewer-markup-freeform. Using default freeform element.`));
|
|
215
|
+
if (element != null) {
|
|
216
|
+
return element;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return document.createElement('vertex-viewer-markup-freeform');
|
|
220
|
+
}
|
|
202
221
|
async updatePropsOnMarkups() {
|
|
203
222
|
const markup = await this.getMarkupElements();
|
|
204
223
|
markup.forEach((m) => this.updatePropsOnMarkup(m));
|
|
@@ -213,6 +232,7 @@ const ViewerMarkup = class {
|
|
|
213
232
|
tool.disabled = this.disabled;
|
|
214
233
|
tool.arrowTemplateId = this.arrowTemplateId;
|
|
215
234
|
tool.circleTemplateId = this.circleTemplateId;
|
|
235
|
+
tool.freeformTemplateId = this.freeformTemplateId;
|
|
216
236
|
tool.tool = this.tool;
|
|
217
237
|
tool.viewer = this.viewer;
|
|
218
238
|
}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
|
-
const bundle_esm = require('./bundle.esm-
|
|
10
|
-
const orientation = require('./orientation-
|
|
11
|
-
const viewport = require('./viewport-
|
|
12
|
-
const constants = require('./constants-
|
|
13
|
-
const dom = require('./dom-
|
|
9
|
+
const bundle_esm = require('./bundle.esm-b79513ef.js');
|
|
10
|
+
const orientation = require('./orientation-09d0f3ef.js');
|
|
11
|
+
const viewport = require('./viewport-fc405a48.js');
|
|
12
|
+
const constants = require('./constants-1d65ed39.js');
|
|
13
|
+
const dom = require('./dom-40804039.js');
|
|
14
14
|
const index$1 = require('./index-3bc6bac0.js');
|
|
15
|
-
const cursors = require('./cursors-
|
|
16
|
-
require('./browser.esm-
|
|
15
|
+
const cursors = require('./cursors-8aaf500f.js');
|
|
16
|
+
require('./browser.esm-17419694.js');
|
|
17
17
|
require('./_commonjsHelpers-537d719a.js');
|
|
18
18
|
|
|
19
19
|
function getMeasurementBoundingClientRect(el) {
|
|
@@ -236,7 +236,7 @@ const ViewerMeasurementDistance = class {
|
|
|
236
236
|
*/
|
|
237
237
|
render() {
|
|
238
238
|
const positions = this.computeElementPositions();
|
|
239
|
-
const { startPt, endPt, labelPt, indicatorPt, hideStart, hideEnd
|
|
239
|
+
const { startPt, endPt, labelPt, indicatorPt, hideStart, hideEnd } = positions;
|
|
240
240
|
const distance = this.formatDistance(this.distance);
|
|
241
241
|
if (this.mode === 'edit') {
|
|
242
242
|
return (index.h(index.Host, null, index.h("div", { class: "measurement" }, index.h(DistanceMeasurementRenderer, { startPt: startPt, endPt: endPt, centerPt: labelPt, indicatorPt: indicatorPt, distance: distance, anchorLabelOffset: this.anchorLabelOffset, lineCapLength: this.lineCapLength, hideStartAnchor: hideStart, hideEndAnchor: hideEnd, onStartAnchorPointerDown: this.handleEditAnchor('start'), onEndAnchorPointerDown: this.handleEditAnchor('end') }))));
|
|
@@ -7,11 +7,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
9
|
const templates = require('./templates-e57b3741.js');
|
|
10
|
-
require('./orientation-
|
|
11
|
-
const measurement = require('./measurement-
|
|
12
|
-
const constants = require('./constants-
|
|
13
|
-
require('./browser.esm-
|
|
14
|
-
require('./bundle.esm-
|
|
10
|
+
require('./orientation-09d0f3ef.js');
|
|
11
|
+
const measurement = require('./measurement-4579193b.js');
|
|
12
|
+
const constants = require('./constants-1d65ed39.js');
|
|
13
|
+
require('./browser.esm-17419694.js');
|
|
14
|
+
require('./bundle.esm-b79513ef.js');
|
|
15
15
|
|
|
16
16
|
const viewerMeasurementToolCss = ":host{position:absolute;top:0;bottom:0;left:0;right:0}";
|
|
17
17
|
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
|
-
const constants = require('./constants-
|
|
9
|
+
const constants = require('./constants-1d65ed39.js');
|
|
10
10
|
const templates = require('./templates-e57b3741.js');
|
|
11
|
-
require('./orientation-
|
|
12
|
-
const measurement = require('./measurement-
|
|
13
|
-
require('./bundle.esm-
|
|
14
|
-
require('./browser.esm-
|
|
11
|
+
require('./orientation-09d0f3ef.js');
|
|
12
|
+
const measurement = require('./measurement-4579193b.js');
|
|
13
|
+
require('./bundle.esm-b79513ef.js');
|
|
14
|
+
require('./browser.esm-17419694.js');
|
|
15
15
|
|
|
16
16
|
const viewerMeasurementsCss = ":host{display:block;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}::slotted(.viewer-measurements__measurement[mode='']){cursor:pointer}::slotted(.viewer-measurements__measurement[mode='edit']){z-index:1}::slotted(.viewer-measurements__measurement[interacting-anchor='start']),::slotted(.viewer-measurements__measurement[interacting-anchor='end']),::slotted(vertex-viewer-measurement-tool[is-measuring]){z-index:2}";
|
|
17
17
|
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6b9ad5cb.js');
|
|
9
|
-
const bundle_esm = require('./bundle.esm-
|
|
9
|
+
const bundle_esm = require('./bundle.esm-b79513ef.js');
|
|
10
10
|
const stencil = require('./stencil-60732441.js');
|
|
11
|
-
const orientation = require('./orientation-
|
|
11
|
+
const orientation = require('./orientation-09d0f3ef.js');
|
|
12
12
|
const index$1 = require('./index-3bc6bac0.js');
|
|
13
|
-
require('./browser.esm-
|
|
13
|
+
require('./browser.esm-17419694.js');
|
|
14
14
|
require('./_commonjsHelpers-537d719a.js');
|
|
15
15
|
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|