@ohif/app 3.13.0-beta.22 → 3.13.0-beta.24
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/{6409.bundle.24edbaa283b7c521b8f7.js → 2075.bundle.a9783d07b48ca241486e.js} +239 -168
- package/dist/{3081.bundle.4827fd9286b00caabfa3.js → 3081.bundle.9342d2003030eb3c9541.js} +2 -2
- package/dist/{3461.bundle.10a4215bacbe33fb8833.js → 3461.bundle.9502d3707ecc5d0323c1.js} +3 -3
- package/dist/{4287.bundle.571587a1d29d54203175.js → 4287.bundle.c6bd6cf991e2dae32044.js} +111 -35
- package/dist/{5028.bundle.6e230efd1a84fbc02f04.js → 5028.bundle.9e63b5082d8856ee41d3.js} +2 -2
- package/dist/{2031.bundle.a17bc2d85cef3a9fea57.js → 581.bundle.2bb402f7316b6e8c735b.js} +326 -231
- package/dist/{6280.bundle.6574101421b8a4ab6777.js → 6280.bundle.828ccda61aa5c83408a5.js} +425 -567
- package/dist/{2816.bundle.838fa4d72921c026083c.js → 6386.bundle.d1be64fd274877e918d9.js} +30 -58
- package/dist/{8665.bundle.056dcd3e86743de2526c.js → 7537.bundle.5a26371cf1368d0e5cf2.js} +321 -75
- package/dist/{8305.bundle.4fae34f80d4847a92b75.js → 8305.bundle.301fbc7d0a3183da4f42.js} +2 -2
- package/dist/{8583.bundle.8e942c4509f38b051b6d.js → 8583.bundle.93f05da9435c53fa229b.js} +2 -2
- package/dist/{9195.bundle.2b62b5e5603641bfb3e3.js → 9195.bundle.a49c44d839f09c1190c1.js} +4 -5
- package/dist/{9205.bundle.dca4f040999d069f1cc5.js → 9205.bundle.a37976b4f3ded2cbb2ab.js} +587 -709
- package/dist/{933.bundle.c8f45e1f380ad5a34e07.js → 933.bundle.a6220d057519db0b7651.js} +2 -2
- package/dist/{app.bundle.02fe1810f12db88c338c.js → app.bundle.000d2cfe6893ffbe84b7.js} +323 -116
- package/dist/{compute.bundle.6bc9d64acadd16a85f59.js → compute.bundle.0fa6bd11224eb79e7474.js} +3 -3
- package/dist/index.html +1 -1
- package/dist/{polySeg.bundle.41c40b57dd1b265fb425.js → polySeg.bundle.f15c8d2cc2559db627cf.js} +3 -3
- package/dist/sw.js +1 -1
- package/package.json +21 -21
- /package/dist/{1459.bundle.2e54707e8b0441c92529.js → 1459.bundle.5b7a328ae89a35622205.js} +0 -0
- /package/dist/{1933.bundle.5fc7cc04fa7173ed99f8.js → 1933.bundle.1d1345d08f29ad45a14b.js} +0 -0
- /package/dist/{2018.bundle.23291da4d4b0999e7d09.js → 2018.bundle.d6cdff8149ad69a965cc.js} +0 -0
- /package/dist/{213.bundle.ccad84ceab8ee1550a87.js → 213.bundle.393be8a0d3a201634ac1.js} +0 -0
- /package/dist/{2424.bundle.016d435d2a499d3ac883.js → 2424.bundle.f18df7bc54510ab32a35.js} +0 -0
- /package/dist/{3138.bundle.8f7afbbaffadcbc9a5fc.js → 3138.bundle.79170d908a4106874093.js} +0 -0
- /package/dist/{4507.bundle.f14d5e470efb072ee645.js → 4507.bundle.8969b09dd3f576cddfcf.js} +0 -0
- /package/dist/{4819.bundle.22278e87b9fcfe848657.js → 4819.bundle.e581d194b62f08c4eb77.js} +0 -0
- /package/dist/{5015.bundle.36ad9402be736e9c2be3.js → 5015.bundle.81781390053c546e29be.js} +0 -0
- /package/dist/{5457.bundle.2755c84844d1a15dec0b.js → 5457.bundle.7bd5092726bacbd503aa.js} +0 -0
- /package/dist/{5485.bundle.eafdd69f92e6475a5963.js → 5485.bundle.334868b4aca965dfacf5.js} +0 -0
- /package/dist/{6027.bundle.59ee43ff7d47158aaad7.js → 6027.bundle.ac07b32905cbdd321fb5.js} +0 -0
- /package/dist/{7431.bundle.e6f5f5835a3c49e2309c.js → 7431.bundle.8ddbd21f7b2b8528a14a.js} +0 -0
- /package/dist/{7639.bundle.ab61d5effce0ec748058.js → 7639.bundle.78557dd05ae0f5511807.js} +0 -0
- /package/dist/{8499.bundle.a6b181ee4bb1feb500f5.js → 8499.bundle.f8ea964333994b9ff842.js} +0 -0
- /package/dist/{85.bundle.ef705801c1f76c0b6231.js → 85.bundle.058fe8907052935c7ff9.js} +0 -0
- /package/dist/{8558.bundle.936313d9744e5fd94f0d.js → 8558.bundle.7be97925dbf90ed792f9.js} +0 -0
- /package/dist/{9927.bundle.a5605e1bbae457a20feb.js → 9927.bundle.9e5cecd52ac87d90649e.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[
|
|
2
|
+
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[2075],{
|
|
3
3
|
|
|
4
4
|
/***/ 18262
|
|
5
5
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -81,10 +81,16 @@ function clearUntouched(svgLayerElement, canvasHash) {
|
|
|
81
81
|
}
|
|
82
82
|
/* harmony default export */ const drawingSvg_getSvgDrawingHelper = (getSvgDrawingHelper);
|
|
83
83
|
|
|
84
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/drawing/textBoxOverlapRegistry.js
|
|
85
|
+
var textBoxOverlapRegistry = __webpack_require__(49773);
|
|
84
86
|
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/draw.js
|
|
85
87
|
|
|
88
|
+
|
|
86
89
|
function draw(element, fn) {
|
|
87
90
|
const svgDrawingHelper = drawingSvg_getSvgDrawingHelper(element);
|
|
91
|
+
if (svgDrawingHelper.svgLayerElement) {
|
|
92
|
+
(0,textBoxOverlapRegistry/* clearTextBoxRegistry */.F4)(svgDrawingHelper.svgLayerElement);
|
|
93
|
+
}
|
|
88
94
|
fn(svgDrawingHelper);
|
|
89
95
|
svgDrawingHelper.clearUntouched();
|
|
90
96
|
}
|
|
@@ -164,69 +170,6 @@ function drawHandles(svgDrawingHelper, annotationUID, handleGroupUID, handlePoin
|
|
|
164
170
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (drawHandles);
|
|
165
171
|
|
|
166
172
|
|
|
167
|
-
/***/ },
|
|
168
|
-
|
|
169
|
-
/***/ 1595
|
|
170
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// EXPORTS
|
|
174
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
175
|
-
A: () => (/* binding */ drawingSvg_drawLinkedTextBox)
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawTextBox.js
|
|
179
|
-
var drawTextBox = __webpack_require__(26290);
|
|
180
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawLine.js
|
|
181
|
-
var drawLine = __webpack_require__(92118);
|
|
182
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/vec2/findClosestPoint.js
|
|
183
|
-
var findClosestPoint = __webpack_require__(90554);
|
|
184
|
-
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawLink.js
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
function drawLink(svgDrawingHelper, annotationUID, linkUID, annotationAnchorPoints, refPoint, boundingBox, options = {}) {
|
|
188
|
-
const start = annotationAnchorPoints.length > 0
|
|
189
|
-
? (0,findClosestPoint/* default */.A)(annotationAnchorPoints, refPoint)
|
|
190
|
-
: refPoint;
|
|
191
|
-
const boundingBoxPoints = _boundingBoxPoints(boundingBox);
|
|
192
|
-
const end = (0,findClosestPoint/* default */.A)(boundingBoxPoints, start);
|
|
193
|
-
const mergedOptions = Object.assign({
|
|
194
|
-
color: 'rgb(255, 255, 0)',
|
|
195
|
-
lineWidth: '1',
|
|
196
|
-
lineDash: '2,3',
|
|
197
|
-
}, options);
|
|
198
|
-
(0,drawLine/* default */.A)(svgDrawingHelper, annotationUID, `link-${linkUID}`, start, end, mergedOptions);
|
|
199
|
-
}
|
|
200
|
-
function _boundingBoxPoints(boundingBox) {
|
|
201
|
-
const { x: left, y: top, height, width } = boundingBox;
|
|
202
|
-
const halfWidth = width / 2;
|
|
203
|
-
const halfHeight = height / 2;
|
|
204
|
-
const topMiddle = [left + halfWidth, top];
|
|
205
|
-
const leftMiddle = [left, top + halfHeight];
|
|
206
|
-
const bottomMiddle = [left + halfWidth, top + height];
|
|
207
|
-
const rightMiddle = [left + width, top + halfHeight];
|
|
208
|
-
return [topMiddle, leftMiddle, bottomMiddle, rightMiddle];
|
|
209
|
-
}
|
|
210
|
-
/* harmony default export */ const drawingSvg_drawLink = (drawLink);
|
|
211
|
-
|
|
212
|
-
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawLinkedTextBox.js
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
function drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, annotationAnchorPoints, textBox, options = {}) {
|
|
216
|
-
const mergedOptions = Object.assign({
|
|
217
|
-
handleRadius: '6',
|
|
218
|
-
centering: {
|
|
219
|
-
x: false,
|
|
220
|
-
y: true,
|
|
221
|
-
},
|
|
222
|
-
}, options);
|
|
223
|
-
const canvasBoundingBox = (0,drawTextBox/* default */.A)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, mergedOptions);
|
|
224
|
-
drawingSvg_drawLink(svgDrawingHelper, annotationUID, textBoxUID, annotationAnchorPoints, textBoxPosition, canvasBoundingBox, mergedOptions);
|
|
225
|
-
return canvasBoundingBox;
|
|
226
|
-
}
|
|
227
|
-
/* harmony default export */ const drawingSvg_drawLinkedTextBox = (drawLinkedTextBox);
|
|
228
|
-
|
|
229
|
-
|
|
230
173
|
/***/ },
|
|
231
174
|
|
|
232
175
|
/***/ 97530
|
|
@@ -673,7 +616,7 @@ class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBP
|
|
|
673
616
|
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
674
617
|
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3823);
|
|
675
618
|
/* harmony import */ var _utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4096);
|
|
676
|
-
/* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
619
|
+
/* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18153);
|
|
677
620
|
/* harmony import */ var _utilities_planar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13165);
|
|
678
621
|
/* harmony import */ var _utilities_throttle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(27730);
|
|
679
622
|
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(60810);
|
|
@@ -685,16 +628,12 @@ class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBP
|
|
|
685
628
|
/* harmony import */ var _planarFreehandROITool_openContourEndEditLoop__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(70734);
|
|
686
629
|
/* harmony import */ var _planarFreehandROITool_renderMethods__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(58161);
|
|
687
630
|
/* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(44049);
|
|
688
|
-
/* harmony import */ var
|
|
689
|
-
/* harmony import */ var
|
|
690
|
-
/* harmony import */ var
|
|
691
|
-
/* harmony import */ var
|
|
692
|
-
/* harmony import */ var
|
|
693
|
-
/* harmony import */ var
|
|
694
|
-
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(29857);
|
|
695
|
-
/* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(40634);
|
|
696
|
-
|
|
697
|
-
|
|
631
|
+
/* harmony import */ var _utilities_math_polyline__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(92984);
|
|
632
|
+
/* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(18990);
|
|
633
|
+
/* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(73262);
|
|
634
|
+
/* harmony import */ var _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(36320);
|
|
635
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(29857);
|
|
636
|
+
/* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(40634);
|
|
698
637
|
|
|
699
638
|
|
|
700
639
|
|
|
@@ -720,7 +659,7 @@ class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBP
|
|
|
720
659
|
const { pointCanProjectOnLine } = _utilities_math__WEBPACK_IMPORTED_MODULE_3__.polyline;
|
|
721
660
|
const { EPSILON } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.CONSTANTS;
|
|
722
661
|
const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
723
|
-
class PlanarFreehandROITool extends
|
|
662
|
+
class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .A {
|
|
724
663
|
static { this.toolName = 'PlanarFreehandROI'; }
|
|
725
664
|
constructor(toolProps = {}, defaultToolProps = {
|
|
726
665
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
@@ -728,7 +667,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
|
|
|
728
667
|
storePointData: false,
|
|
729
668
|
shadow: true,
|
|
730
669
|
preventHandleOutsideImage: false,
|
|
731
|
-
contourHoleAdditionModifierKey:
|
|
670
|
+
contourHoleAdditionModifierKey: _enums__WEBPACK_IMPORTED_MODULE_19__.KeyboardBindings.Shift,
|
|
732
671
|
alwaysRenderOpenContourHandles: {
|
|
733
672
|
enabled: false,
|
|
734
673
|
radius: 2,
|
|
@@ -755,7 +694,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
|
|
|
755
694
|
displayOnePointAsCrosshairs: false,
|
|
756
695
|
calculateStats: true,
|
|
757
696
|
getTextLines: defaultGetTextLines,
|
|
758
|
-
statsCalculator:
|
|
697
|
+
statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_17__.BasicStatsCalculator,
|
|
759
698
|
},
|
|
760
699
|
}) {
|
|
761
700
|
super(toolProps, defaultToolProps);
|
|
@@ -840,10 +779,10 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
|
|
|
840
779
|
const { imageData, metadata } = image;
|
|
841
780
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
842
781
|
const modalityUnitOptions = {
|
|
843
|
-
isPreScaled: (0,
|
|
782
|
+
isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_16__/* .isViewportPreScaled */ .u)(viewport, targetId),
|
|
844
783
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
845
784
|
};
|
|
846
|
-
const modalityUnit = (0,
|
|
785
|
+
const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_20__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
|
|
847
786
|
const polyline = data.contour.polyline;
|
|
848
787
|
const numPoints = polyline.length;
|
|
849
788
|
const projectedPolyline = new Array(numPoints);
|
|
@@ -895,7 +834,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
|
|
|
895
834
|
const invalidated = annotation.invalidated;
|
|
896
835
|
annotation.invalidated = false;
|
|
897
836
|
if (invalidated) {
|
|
898
|
-
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_14__.triggerAnnotationModified)(annotation, enabledElement.viewport.element,
|
|
837
|
+
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_14__.triggerAnnotationModified)(annotation, enabledElement.viewport.element, _enums__WEBPACK_IMPORTED_MODULE_19__.ChangeTypes.StatsUpdated);
|
|
899
838
|
}
|
|
900
839
|
return cachedStats;
|
|
901
840
|
};
|
|
@@ -908,30 +847,19 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
|
|
|
908
847
|
viewportId: enabledElement.viewport.id,
|
|
909
848
|
annotationUID: annotation.annotationUID,
|
|
910
849
|
};
|
|
911
|
-
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
912
|
-
if (!options.visibility) {
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
850
|
const textLines = this.configuration.getTextLines(data, targetId);
|
|
916
851
|
if (!textLines || textLines.length === 0) {
|
|
917
852
|
return;
|
|
918
853
|
}
|
|
919
854
|
const canvasCoordinates = data.contour.polyline.map((p) => viewport.worldToCanvas(p));
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
const { x: left, y: top, width, height } = boundingBox;
|
|
929
|
-
data.handles.textBox.worldBoundingBox = {
|
|
930
|
-
topLeft: viewport.canvasToWorld([left, top]),
|
|
931
|
-
topRight: viewport.canvasToWorld([left + width, top]),
|
|
932
|
-
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
933
|
-
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
934
|
-
};
|
|
855
|
+
this.renderLinkedTextBoxAnnotation({
|
|
856
|
+
enabledElement,
|
|
857
|
+
svgDrawingHelper,
|
|
858
|
+
annotation,
|
|
859
|
+
styleSpecifier,
|
|
860
|
+
textLines,
|
|
861
|
+
canvasCoordinates,
|
|
862
|
+
});
|
|
935
863
|
};
|
|
936
864
|
(0,_planarFreehandROITool_drawLoop__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A)(this);
|
|
937
865
|
(0,_planarFreehandROITool_editLoopCommon__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)(this);
|
|
@@ -1167,7 +1095,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
|
|
|
1167
1095
|
if (point[1] != curRow) {
|
|
1168
1096
|
intersectionCounter = 0;
|
|
1169
1097
|
curRow = point[1];
|
|
1170
|
-
intersections = (0,
|
|
1098
|
+
intersections = (0,_utilities_math_polyline__WEBPACK_IMPORTED_MODULE_15__.getLineSegmentIntersectionsCoordinates)(canvasCoordinates, point, [canvasPosEnd[0], point[1]]);
|
|
1171
1099
|
intersections.sort((function (index) {
|
|
1172
1100
|
return function (a, b) {
|
|
1173
1101
|
return a[index] === b[index]
|
|
@@ -1196,13 +1124,13 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
|
|
|
1196
1124
|
name: 'area',
|
|
1197
1125
|
value: area,
|
|
1198
1126
|
unit: areaUnit,
|
|
1199
|
-
type:
|
|
1127
|
+
type: _enums__WEBPACK_IMPORTED_MODULE_19__.MeasurementType.Area,
|
|
1200
1128
|
};
|
|
1201
1129
|
const namedPerimeter = {
|
|
1202
1130
|
name: 'perimeter',
|
|
1203
1131
|
value: perimeter,
|
|
1204
1132
|
unit,
|
|
1205
|
-
type:
|
|
1133
|
+
type: _enums__WEBPACK_IMPORTED_MODULE_19__.MeasurementType.Linear,
|
|
1206
1134
|
};
|
|
1207
1135
|
cachedStats[targetId] = {
|
|
1208
1136
|
Modality: metadata.Modality,
|
|
@@ -1227,7 +1155,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
|
|
|
1227
1155
|
name: 'length',
|
|
1228
1156
|
value: length,
|
|
1229
1157
|
unit,
|
|
1230
|
-
type:
|
|
1158
|
+
type: _enums__WEBPACK_IMPORTED_MODULE_19__.MeasurementType.Linear,
|
|
1231
1159
|
};
|
|
1232
1160
|
cachedStats[targetId] = {
|
|
1233
1161
|
Modality: metadata.Modality,
|
|
@@ -1293,14 +1221,12 @@ function defaultGetTextLines(data, targetId) {
|
|
|
1293
1221
|
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29857);
|
|
1294
1222
|
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(60810);
|
|
1295
1223
|
/* harmony import */ var _utilities_math_rectangle__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(33657);
|
|
1296
|
-
/* harmony import */ var
|
|
1297
|
-
/* harmony import */ var
|
|
1298
|
-
/* harmony import */ var
|
|
1299
|
-
/* harmony import */ var
|
|
1300
|
-
/* harmony import */ var
|
|
1301
|
-
/* harmony import */ var
|
|
1302
|
-
/* harmony import */ var _stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(76712);
|
|
1303
|
-
|
|
1224
|
+
/* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(7001);
|
|
1225
|
+
/* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(58640);
|
|
1226
|
+
/* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(40634);
|
|
1227
|
+
/* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(18990);
|
|
1228
|
+
/* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(73262);
|
|
1229
|
+
/* harmony import */ var _stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(76712);
|
|
1304
1230
|
|
|
1305
1231
|
|
|
1306
1232
|
|
|
@@ -1332,7 +1258,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1332
1258
|
preventHandleOutsideImage: false,
|
|
1333
1259
|
calculateStats: true,
|
|
1334
1260
|
getTextLines: defaultGetTextLines,
|
|
1335
|
-
statsCalculator:
|
|
1261
|
+
statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_18__.BasicStatsCalculator,
|
|
1336
1262
|
},
|
|
1337
1263
|
}) {
|
|
1338
1264
|
super(toolProps, defaultToolProps);
|
|
@@ -1377,9 +1303,9 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1377
1303
|
hasMoved: false,
|
|
1378
1304
|
};
|
|
1379
1305
|
this._activateDraw(element);
|
|
1380
|
-
(0,
|
|
1306
|
+
(0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
|
|
1381
1307
|
evt.preventDefault();
|
|
1382
|
-
(0,
|
|
1308
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
|
|
1383
1309
|
return annotation;
|
|
1384
1310
|
};
|
|
1385
1311
|
this.isPointNearTool = (element, annotation, canvasCoords, proximity) => {
|
|
@@ -1412,10 +1338,10 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1412
1338
|
movingTextBox: false,
|
|
1413
1339
|
};
|
|
1414
1340
|
this._activateModify(element);
|
|
1415
|
-
(0,
|
|
1341
|
+
(0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
|
|
1416
1342
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
1417
1343
|
const { renderingEngine } = enabledElement;
|
|
1418
|
-
(0,
|
|
1344
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
|
|
1419
1345
|
evt.preventDefault();
|
|
1420
1346
|
};
|
|
1421
1347
|
this.handleSelectedCallback = (evt, annotation, handle) => {
|
|
@@ -1439,10 +1365,10 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1439
1365
|
movingTextBox,
|
|
1440
1366
|
};
|
|
1441
1367
|
this._activateModify(element);
|
|
1442
|
-
(0,
|
|
1368
|
+
(0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
|
|
1443
1369
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
1444
1370
|
const { renderingEngine } = enabledElement;
|
|
1445
|
-
(0,
|
|
1371
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
|
|
1446
1372
|
evt.preventDefault();
|
|
1447
1373
|
};
|
|
1448
1374
|
this._endCallback = (evt) => {
|
|
@@ -1456,7 +1382,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1456
1382
|
data.handles.activeHandleIndex = null;
|
|
1457
1383
|
this._deactivateModify(element);
|
|
1458
1384
|
this._deactivateDraw(element);
|
|
1459
|
-
(0,
|
|
1385
|
+
(0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.resetElementCursor)(element);
|
|
1460
1386
|
this.doneEditMemo();
|
|
1461
1387
|
this.editData = null;
|
|
1462
1388
|
this.isDrawing = false;
|
|
@@ -1464,7 +1390,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1464
1390
|
this.configuration.preventHandleOutsideImage) {
|
|
1465
1391
|
(0,_stateManagement__WEBPACK_IMPORTED_MODULE_5__/* .removeAnnotation */ .O8)(annotation.annotationUID);
|
|
1466
1392
|
}
|
|
1467
|
-
(0,
|
|
1393
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
|
|
1468
1394
|
if (newAnnotation) {
|
|
1469
1395
|
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationCompleted)(annotation);
|
|
1470
1396
|
}
|
|
@@ -1546,7 +1472,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1546
1472
|
}
|
|
1547
1473
|
this.editData.hasMoved = true;
|
|
1548
1474
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
1549
|
-
(0,
|
|
1475
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
|
|
1550
1476
|
if (annotation.invalidated) {
|
|
1551
1477
|
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationModified)(annotation, element, _enums__WEBPACK_IMPORTED_MODULE_11__.ChangeTypes.HandlesUpdated);
|
|
1552
1478
|
}
|
|
@@ -1556,12 +1482,12 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1556
1482
|
this.isDrawing = false;
|
|
1557
1483
|
this._deactivateDraw(element);
|
|
1558
1484
|
this._deactivateModify(element);
|
|
1559
|
-
(0,
|
|
1485
|
+
(0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.resetElementCursor)(element);
|
|
1560
1486
|
const { annotation, viewportIdsToRender, newAnnotation } = this.editData;
|
|
1561
1487
|
const { data } = annotation;
|
|
1562
1488
|
annotation.highlighted = false;
|
|
1563
1489
|
data.handles.activeHandleIndex = null;
|
|
1564
|
-
(0,
|
|
1490
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
|
|
1565
1491
|
if (newAnnotation) {
|
|
1566
1492
|
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationCompleted)(annotation);
|
|
1567
1493
|
}
|
|
@@ -1683,7 +1609,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1683
1609
|
activeHandleIndex !== undefined) {
|
|
1684
1610
|
activeHandleCanvasCoords = [canvasCoordinates[activeHandleIndex]];
|
|
1685
1611
|
}
|
|
1686
|
-
const showHandlesAlways = Boolean((0,
|
|
1612
|
+
const showHandlesAlways = Boolean((0,_stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_19__/* .getStyleProperty */ .h)('showHandlesAlways', {}));
|
|
1687
1613
|
if (activeHandleCanvasCoords || showHandlesAlways) {
|
|
1688
1614
|
const handleGroupUID = '0';
|
|
1689
1615
|
(0,_drawingSvg__WEBPACK_IMPORTED_MODULE_9__.drawHandles)(svgDrawingHelper, annotationUID, handleGroupUID, showHandlesAlways ? canvasCoordinates : activeHandleCanvasCoords, {
|
|
@@ -1698,39 +1624,20 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1698
1624
|
lineWidth,
|
|
1699
1625
|
}, dataId);
|
|
1700
1626
|
renderStatus = true;
|
|
1701
|
-
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
1702
|
-
if (!options.visibility) {
|
|
1703
|
-
data.handles.textBox = {
|
|
1704
|
-
hasMoved: false,
|
|
1705
|
-
worldPosition: [0, 0, 0],
|
|
1706
|
-
worldBoundingBox: {
|
|
1707
|
-
topLeft: [0, 0, 0],
|
|
1708
|
-
topRight: [0, 0, 0],
|
|
1709
|
-
bottomLeft: [0, 0, 0],
|
|
1710
|
-
bottomRight: [0, 0, 0],
|
|
1711
|
-
},
|
|
1712
|
-
};
|
|
1713
|
-
continue;
|
|
1714
|
-
}
|
|
1715
1627
|
const textLines = this.configuration.getTextLines(data, targetId);
|
|
1716
1628
|
if (!textLines || textLines.length === 0) {
|
|
1717
1629
|
continue;
|
|
1718
1630
|
}
|
|
1719
|
-
if (!
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1631
|
+
if (!this.renderLinkedTextBoxAnnotation({
|
|
1632
|
+
enabledElement,
|
|
1633
|
+
svgDrawingHelper,
|
|
1634
|
+
annotation,
|
|
1635
|
+
styleSpecifier,
|
|
1636
|
+
textLines,
|
|
1637
|
+
canvasCoordinates,
|
|
1638
|
+
})) {
|
|
1639
|
+
continue;
|
|
1723
1640
|
}
|
|
1724
|
-
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
1725
|
-
const textBoxUID = '1';
|
|
1726
|
-
const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_9__.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
|
|
1727
|
-
const { x: left, y: top, width, height } = boundingBox;
|
|
1728
|
-
data.handles.textBox.worldBoundingBox = {
|
|
1729
|
-
topLeft: viewport.canvasToWorld([left, top]),
|
|
1730
|
-
topRight: viewport.canvasToWorld([left + width, top]),
|
|
1731
|
-
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
1732
|
-
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
1733
|
-
};
|
|
1734
1641
|
}
|
|
1735
1642
|
return renderStatus;
|
|
1736
1643
|
};
|
|
@@ -1783,10 +1690,10 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1783
1690
|
const area = Math.abs(width * height);
|
|
1784
1691
|
const { areaUnit } = calibrate;
|
|
1785
1692
|
const pixelUnitsOptions = {
|
|
1786
|
-
isPreScaled: (0,
|
|
1693
|
+
isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_17__/* .isViewportPreScaled */ .u)(viewport, targetId),
|
|
1787
1694
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
1788
1695
|
};
|
|
1789
|
-
const modalityUnit = (0,
|
|
1696
|
+
const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_16__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
|
|
1790
1697
|
let pointsInShape;
|
|
1791
1698
|
if (voxelManager) {
|
|
1792
1699
|
pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
|
|
@@ -1860,7 +1767,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
|
|
|
1860
1767
|
},
|
|
1861
1768
|
};
|
|
1862
1769
|
(0,_stateManagement__WEBPACK_IMPORTED_MODULE_5__/* .addAnnotation */ .lC)(annotation, viewport.element);
|
|
1863
|
-
(0,
|
|
1770
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)([viewport.id]);
|
|
1864
1771
|
}; }
|
|
1865
1772
|
}
|
|
1866
1773
|
function defaultGetTextLines(data, targetId) {
|
|
@@ -1905,10 +1812,14 @@ function defaultGetTextLines(data, targetId) {
|
|
|
1905
1812
|
/* harmony import */ var _stateManagement_annotation_annotationVisibility__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29601);
|
|
1906
1813
|
/* harmony import */ var _stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82056);
|
|
1907
1814
|
/* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(44049);
|
|
1908
|
-
/* harmony import */ var
|
|
1909
|
-
/* harmony import */ var
|
|
1910
|
-
/* harmony import */ var
|
|
1911
|
-
/* harmony import */ var
|
|
1815
|
+
/* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(74347);
|
|
1816
|
+
/* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(473);
|
|
1817
|
+
/* harmony import */ var _enums_ChangeTypes__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(75183);
|
|
1818
|
+
/* harmony import */ var _stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(17343);
|
|
1819
|
+
/* harmony import */ var _utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(56534);
|
|
1820
|
+
/* harmony import */ var _utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(33459);
|
|
1821
|
+
|
|
1822
|
+
|
|
1912
1823
|
|
|
1913
1824
|
|
|
1914
1825
|
|
|
@@ -2023,6 +1934,54 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
|
|
|
2023
1934
|
textBoxLinkLineColor: this.getStyle('textBoxLinkLineColor', specifications, annotation),
|
|
2024
1935
|
};
|
|
2025
1936
|
}
|
|
1937
|
+
renderLinkedTextBoxAnnotation(options) {
|
|
1938
|
+
const { enabledElement, svgDrawingHelper, annotation, styleSpecifier, textLines, canvasCoordinates, textBoxUID = '1', placementPoints, } = options;
|
|
1939
|
+
const { viewport } = enabledElement;
|
|
1940
|
+
const { element } = viewport;
|
|
1941
|
+
const { annotationUID, data } = annotation;
|
|
1942
|
+
const styleOptions = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
1943
|
+
if (!styleOptions.visibility) {
|
|
1944
|
+
data.handles.textBox = {
|
|
1945
|
+
hasMoved: false,
|
|
1946
|
+
worldPosition: [0, 0, 0],
|
|
1947
|
+
worldBoundingBox: {
|
|
1948
|
+
topLeft: [0, 0, 0],
|
|
1949
|
+
topRight: [0, 0, 0],
|
|
1950
|
+
bottomLeft: [0, 0, 0],
|
|
1951
|
+
bottomRight: [0, 0, 0],
|
|
1952
|
+
},
|
|
1953
|
+
};
|
|
1954
|
+
return false;
|
|
1955
|
+
}
|
|
1956
|
+
if (!data.handles.textBox) {
|
|
1957
|
+
data.handles.textBox = {
|
|
1958
|
+
hasMoved: false,
|
|
1959
|
+
worldPosition: [0, 0, 0],
|
|
1960
|
+
worldBoundingBox: {
|
|
1961
|
+
topLeft: [0, 0, 0],
|
|
1962
|
+
topRight: [0, 0, 0],
|
|
1963
|
+
bottomLeft: [0, 0, 0],
|
|
1964
|
+
bottomRight: [0, 0, 0],
|
|
1965
|
+
},
|
|
1966
|
+
};
|
|
1967
|
+
}
|
|
1968
|
+
const pointsForPlacement = placementPoints ?? canvasCoordinates;
|
|
1969
|
+
if (!data.handles.textBox.hasMoved) {
|
|
1970
|
+
const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_8__.getTextBoxCoordsCanvas)(pointsForPlacement, element, textLines);
|
|
1971
|
+
data.handles.textBox.worldPosition =
|
|
1972
|
+
viewport.canvasToWorld(canvasTextBoxCoords);
|
|
1973
|
+
}
|
|
1974
|
+
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
1975
|
+
const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_7__.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, styleOptions);
|
|
1976
|
+
const { x: left, y: top, width, height } = boundingBox;
|
|
1977
|
+
data.handles.textBox.worldBoundingBox = {
|
|
1978
|
+
topLeft: viewport.canvasToWorld([left, top]),
|
|
1979
|
+
topRight: viewport.canvasToWorld([left + width, top]),
|
|
1980
|
+
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
1981
|
+
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
1982
|
+
};
|
|
1983
|
+
return true;
|
|
1984
|
+
}
|
|
2026
1985
|
static isSuvScaled(viewport, targetId, imageId) {
|
|
2027
1986
|
if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport) {
|
|
2028
1987
|
const volumeId = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getVolumeId(targetId);
|
|
@@ -2074,7 +2033,7 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
|
|
|
2074
2033
|
const { data, annotationUID } = annotation;
|
|
2075
2034
|
return {
|
|
2076
2035
|
annotationUID,
|
|
2077
|
-
data: (0,
|
|
2036
|
+
data: (0,_utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_12__/* .safeStructuredClone */ .W)(data),
|
|
2078
2037
|
deleting,
|
|
2079
2038
|
};
|
|
2080
2039
|
}
|
|
@@ -2098,19 +2057,19 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
|
|
|
2098
2057
|
annotationData.contour.polyline = state.data.contour.pointsManager.points;
|
|
2099
2058
|
delete state.data.contour.pointsManager;
|
|
2100
2059
|
if (annotationData.segmentation) {
|
|
2101
|
-
(0,
|
|
2060
|
+
(0,_utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_11__.addContourSegmentationAnnotation)(annotation);
|
|
2102
2061
|
}
|
|
2103
2062
|
}
|
|
2104
2063
|
state.data = newState.data;
|
|
2105
2064
|
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.addAnnotation)(annotation, element);
|
|
2106
|
-
(0,
|
|
2065
|
+
(0,_stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_10__.setAnnotationSelected)(annotation.annotationUID, true);
|
|
2107
2066
|
viewport?.render();
|
|
2108
2067
|
return;
|
|
2109
2068
|
}
|
|
2110
2069
|
if (state.deleting === false) {
|
|
2111
2070
|
state.deleting = true;
|
|
2112
2071
|
state.data = newState.data;
|
|
2113
|
-
(0,
|
|
2072
|
+
(0,_stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_10__.setAnnotationSelected)(annotation.annotationUID);
|
|
2114
2073
|
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.removeAnnotation)(annotation.annotationUID);
|
|
2115
2074
|
viewport?.render();
|
|
2116
2075
|
return;
|
|
@@ -2128,7 +2087,7 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
|
|
|
2128
2087
|
state.data = newState.data;
|
|
2129
2088
|
currentAnnotation.invalidated = true;
|
|
2130
2089
|
if (element) {
|
|
2131
|
-
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__.triggerAnnotationModified)(currentAnnotation, element,
|
|
2090
|
+
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__.triggerAnnotationModified)(currentAnnotation, element, _enums_ChangeTypes__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A.History);
|
|
2132
2091
|
}
|
|
2133
2092
|
},
|
|
2134
2093
|
id: annotationUID,
|
|
@@ -2725,19 +2684,121 @@ function debounce(func, wait, options) {
|
|
|
2725
2684
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2726
2685
|
/* harmony export */ A: () => (/* binding */ getTextBoxCoordsCanvas)
|
|
2727
2686
|
/* harmony export */ });
|
|
2728
|
-
|
|
2687
|
+
/* harmony import */ var _textBoxOverlapRegistry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49773);
|
|
2688
|
+
/* harmony import */ var _math_aabb_intersectAABB__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33277);
|
|
2689
|
+
|
|
2690
|
+
|
|
2691
|
+
const VIEWPORT_ELEMENT = 'viewport-element';
|
|
2692
|
+
const TEXT_BOX_GAP = 6;
|
|
2693
|
+
function getTextBoxCoordsCanvas(annotationCanvasPoints, element, textLines = []) {
|
|
2694
|
+
if (!annotationCanvasPoints?.length || !annotationCanvasPoints[0]) {
|
|
2695
|
+
return [0, 0];
|
|
2696
|
+
}
|
|
2729
2697
|
const corners = _determineCorners(annotationCanvasPoints);
|
|
2730
2698
|
const centerY = (corners.top[1] + corners.bottom[1]) / 2;
|
|
2731
|
-
const
|
|
2732
|
-
|
|
2699
|
+
const defaultTextBoxCanvas = [corners.right[0], centerY];
|
|
2700
|
+
if (!element) {
|
|
2701
|
+
return defaultTextBoxCanvas;
|
|
2702
|
+
}
|
|
2703
|
+
const { width: textBoxWidth, height: textBoxHeight } = _estimateTextBoxSize(textLines);
|
|
2704
|
+
const margin = 4;
|
|
2705
|
+
const maxX = element.clientWidth - margin;
|
|
2706
|
+
const maxY = element.clientHeight - margin;
|
|
2707
|
+
let x = corners.right[0];
|
|
2708
|
+
let y = centerY - textBoxHeight / 2;
|
|
2709
|
+
if (x + textBoxWidth > maxX) {
|
|
2710
|
+
x = corners.left[0] - textBoxWidth;
|
|
2711
|
+
}
|
|
2712
|
+
x = Math.max(margin, Math.min(x, maxX - textBoxWidth));
|
|
2713
|
+
y = Math.max(margin, Math.min(y, maxY - textBoxHeight));
|
|
2714
|
+
const svgLayer = _findSvgLayer(element);
|
|
2715
|
+
if (svgLayer) {
|
|
2716
|
+
const existingBoxes = (0,_textBoxOverlapRegistry__WEBPACK_IMPORTED_MODULE_0__/* .getRegisteredTextBoxes */ .Pd)(svgLayer);
|
|
2717
|
+
if (existingBoxes.length > 0) {
|
|
2718
|
+
const resolved = _resolveOverlap(x, y, textBoxWidth, textBoxHeight, existingBoxes, margin, maxX, maxY);
|
|
2719
|
+
x = resolved[0];
|
|
2720
|
+
y = resolved[1];
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
return [x, y];
|
|
2724
|
+
}
|
|
2725
|
+
function _resolveOverlap(x, y, width, height, existingBoxes, margin, maxX, maxY) {
|
|
2726
|
+
if (!_overlapsAny(x, y, width, height, existingBoxes)) {
|
|
2727
|
+
return [x, y];
|
|
2728
|
+
}
|
|
2729
|
+
let candidateY = y;
|
|
2730
|
+
for (let i = 0; i < 30; i++) {
|
|
2731
|
+
const blocker = _findFirstOverlap(x, candidateY, width, height, existingBoxes);
|
|
2732
|
+
if (!blocker) {
|
|
2733
|
+
break;
|
|
2734
|
+
}
|
|
2735
|
+
candidateY = blocker.y + blocker.height + TEXT_BOX_GAP;
|
|
2736
|
+
if (candidateY + height > maxY) {
|
|
2737
|
+
candidateY = Infinity;
|
|
2738
|
+
break;
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
if (candidateY !== Infinity &&
|
|
2742
|
+
!_overlapsAny(x, candidateY, width, height, existingBoxes)) {
|
|
2743
|
+
return [
|
|
2744
|
+
x,
|
|
2745
|
+
Math.max(margin, Math.min(candidateY, maxY - height)),
|
|
2746
|
+
];
|
|
2747
|
+
}
|
|
2748
|
+
candidateY = y;
|
|
2749
|
+
for (let i = 0; i < 30; i++) {
|
|
2750
|
+
const blocker = _findFirstOverlap(x, candidateY, width, height, existingBoxes);
|
|
2751
|
+
if (!blocker) {
|
|
2752
|
+
break;
|
|
2753
|
+
}
|
|
2754
|
+
candidateY = blocker.y - height - TEXT_BOX_GAP;
|
|
2755
|
+
if (candidateY < margin) {
|
|
2756
|
+
candidateY = -Infinity;
|
|
2757
|
+
break;
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
if (candidateY !== -Infinity &&
|
|
2761
|
+
!_overlapsAny(x, candidateY, width, height, existingBoxes)) {
|
|
2762
|
+
return [
|
|
2763
|
+
x,
|
|
2764
|
+
Math.max(margin, Math.min(candidateY, maxY - height)),
|
|
2765
|
+
];
|
|
2766
|
+
}
|
|
2767
|
+
return [x, y];
|
|
2768
|
+
}
|
|
2769
|
+
function _overlapsAny(x, y, w, h, boxes) {
|
|
2770
|
+
const candidate = _toTextBoxAABB({ x, y, width: w, height: h });
|
|
2771
|
+
return boxes.some((box) => (0,_math_aabb_intersectAABB__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(candidate, _toTextBoxAABB(box, TEXT_BOX_GAP / 2)));
|
|
2772
|
+
}
|
|
2773
|
+
function _findFirstOverlap(x, y, w, h, boxes) {
|
|
2774
|
+
const candidate = _toTextBoxAABB({ x, y, width: w, height: h });
|
|
2775
|
+
return boxes.find((box) => (0,_math_aabb_intersectAABB__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(candidate, _toTextBoxAABB(box, TEXT_BOX_GAP / 2)));
|
|
2776
|
+
}
|
|
2777
|
+
function _toTextBoxAABB(rect, inflate = 0) {
|
|
2778
|
+
return {
|
|
2779
|
+
minX: rect.x - inflate,
|
|
2780
|
+
minY: rect.y - inflate,
|
|
2781
|
+
maxX: rect.x + rect.width + inflate,
|
|
2782
|
+
maxY: rect.y + rect.height + inflate,
|
|
2783
|
+
};
|
|
2784
|
+
}
|
|
2785
|
+
function _findSvgLayer(element) {
|
|
2786
|
+
const internalDiv = element.querySelector(`.${VIEWPORT_ELEMENT}`);
|
|
2787
|
+
return internalDiv?.querySelector(':scope > .svg-layer') || null;
|
|
2733
2788
|
}
|
|
2734
2789
|
function _determineCorners(canvasPoints) {
|
|
2790
|
+
const p0 = canvasPoints[0];
|
|
2791
|
+
if (!p0 || canvasPoints.length < 2) {
|
|
2792
|
+
return { left: p0, right: p0, top: p0, bottom: p0 };
|
|
2793
|
+
}
|
|
2735
2794
|
const handlesLeftToRight = [canvasPoints[0], canvasPoints[1]].sort(_compareX);
|
|
2736
2795
|
const handlesTopToBottom = [canvasPoints[0], canvasPoints[1]].sort(_compareY);
|
|
2796
|
+
const left = handlesLeftToRight[0];
|
|
2737
2797
|
const right = handlesLeftToRight[handlesLeftToRight.length - 1];
|
|
2738
2798
|
const top = handlesTopToBottom[0];
|
|
2739
2799
|
const bottom = handlesTopToBottom[handlesTopToBottom.length - 1];
|
|
2740
2800
|
return {
|
|
2801
|
+
left,
|
|
2741
2802
|
top,
|
|
2742
2803
|
bottom,
|
|
2743
2804
|
right,
|
|
@@ -2749,6 +2810,16 @@ function _determineCorners(canvasPoints) {
|
|
|
2749
2810
|
return a[1] < b[1] ? -1 : 1;
|
|
2750
2811
|
}
|
|
2751
2812
|
}
|
|
2813
|
+
function _estimateTextBoxSize(textLines) {
|
|
2814
|
+
const estimatedPadding = 25;
|
|
2815
|
+
const estimatedCharWidth = 8;
|
|
2816
|
+
const estimatedLineHeight = 17;
|
|
2817
|
+
const longestLineLength = textLines.reduce((max, line) => Math.max(max, line?.length ?? 0), 0);
|
|
2818
|
+
const lineCount = Math.max(textLines.length, 1);
|
|
2819
|
+
const width = longestLineLength * estimatedCharWidth + estimatedPadding * 2;
|
|
2820
|
+
const height = lineCount * estimatedLineHeight + estimatedPadding * 2;
|
|
2821
|
+
return { width, height };
|
|
2822
|
+
}
|
|
2752
2823
|
|
|
2753
2824
|
|
|
2754
2825
|
/***/ },
|