@kitware/vtk.js 26.4.1 → 26.5.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/Proxy/Core/View2DProxy.js +28 -10
- package/package.json +1 -1
|
@@ -38,25 +38,43 @@ function formatAnnotationValue(value) {
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
function getPropCoarseHull(prop) {
|
|
41
|
-
var _prop$getMapper,
|
|
41
|
+
var _prop$getMapper, _mapper$getBounds;
|
|
42
42
|
|
|
43
43
|
if (!prop.getVisibility() || !prop.getUseBounds()) {
|
|
44
44
|
return [];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
var
|
|
48
|
-
var
|
|
47
|
+
var finestBounds = prop.getBounds();
|
|
48
|
+
var finestMatrix = null; // Better bounds using mapper bounds and prop matrix
|
|
49
|
+
|
|
50
|
+
var mapper = prop === null || prop === void 0 ? void 0 : (_prop$getMapper = prop.getMapper) === null || _prop$getMapper === void 0 ? void 0 : _prop$getMapper.call(prop);
|
|
51
|
+
var mapperBounds = mapper === null || mapper === void 0 ? void 0 : (_mapper$getBounds = mapper.getBounds) === null || _mapper$getBounds === void 0 ? void 0 : _mapper$getBounds.call(mapper);
|
|
49
52
|
|
|
50
53
|
if (mapperBounds && vtkBoundingBox.isValid(mapperBounds) && prop.getMatrix) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
var _mapper$getInputData;
|
|
55
|
+
|
|
56
|
+
finestBounds = mapperBounds;
|
|
57
|
+
finestMatrix = prop.getMatrix().slice();
|
|
58
|
+
mat4.transpose(finestMatrix, finestMatrix); // Better bounds using the image data matrix and prop matrix + imageData matrix
|
|
59
|
+
|
|
60
|
+
if (mapper.isA('vtkImageMapper') && (_mapper$getInputData = mapper.getInputData()) !== null && _mapper$getInputData !== void 0 && _mapper$getInputData.isA('vtkImageData')) {
|
|
61
|
+
prop.computeMatrix();
|
|
62
|
+
var imageData = mapper.getInputData();
|
|
63
|
+
finestBounds = imageData.getSpatialExtent();
|
|
64
|
+
var imageDataMatrix = imageData.getIndexToWorld();
|
|
65
|
+
mat4.mul(finestMatrix, finestMatrix, imageDataMatrix);
|
|
66
|
+
}
|
|
67
|
+
} // Compute corners and transform them if needed
|
|
68
|
+
// It gives a more accurate hull than computing the corners of a transformed bounding box
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var corners = [];
|
|
72
|
+
vtkBoundingBox.getCorners(finestBounds, corners);
|
|
73
|
+
|
|
74
|
+
if (finestMatrix) {
|
|
54
75
|
corners.forEach(function (pt) {
|
|
55
|
-
return vec3.transformMat4(pt, pt,
|
|
76
|
+
return vec3.transformMat4(pt, pt, finestMatrix);
|
|
56
77
|
});
|
|
57
|
-
} else {
|
|
58
|
-
var propBounds = prop.getBounds();
|
|
59
|
-
vtkBoundingBox.getCorners(propBounds, corners);
|
|
60
78
|
}
|
|
61
79
|
|
|
62
80
|
return corners;
|