@kitware/vtk.js 34.15.0 → 34.15.1
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.
|
@@ -36,6 +36,10 @@ function vtkPolyData(publicAPI, model) {
|
|
|
36
36
|
function camelize(str) {
|
|
37
37
|
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, letter => letter.toUpperCase()).replace(/\s+/g, '');
|
|
38
38
|
}
|
|
39
|
+
function clearCells() {
|
|
40
|
+
model.cells = undefined;
|
|
41
|
+
model.links = undefined;
|
|
42
|
+
}
|
|
39
43
|
|
|
40
44
|
// build empty cell arrays and set methods
|
|
41
45
|
POLYDATA_FIELDS.forEach(type => {
|
|
@@ -45,6 +49,7 @@ function vtkPolyData(publicAPI, model) {
|
|
|
45
49
|
} else {
|
|
46
50
|
model[type] = vtk(model[type]);
|
|
47
51
|
}
|
|
52
|
+
model[`_on${camelize(type)}Changed`] = clearCells;
|
|
48
53
|
});
|
|
49
54
|
publicAPI.getNumberOfCells = () => POLYDATA_FIELDS.reduce((num, cellType) => num + model[cellType].getNumberOfCells(), 0);
|
|
50
55
|
const superShallowCopy = publicAPI.shallowCopy;
|
|
@@ -61,6 +66,7 @@ function vtkPolyData(publicAPI, model) {
|
|
|
61
66
|
const superInitialize = publicAPI.initialize;
|
|
62
67
|
publicAPI.initialize = () => {
|
|
63
68
|
POLYDATA_FIELDS.forEach(type => model[type]?.initialize());
|
|
69
|
+
clearCells();
|
|
64
70
|
return superInitialize();
|
|
65
71
|
};
|
|
66
72
|
publicAPI.buildCells = () => {
|
|
@@ -151,7 +157,7 @@ function vtkPolyData(publicAPI, model) {
|
|
|
151
157
|
*/
|
|
152
158
|
publicAPI.buildLinks = function () {
|
|
153
159
|
let initialSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
154
|
-
if (model.cells
|
|
160
|
+
if (model.cells == null) {
|
|
155
161
|
publicAPI.buildCells();
|
|
156
162
|
}
|
|
157
163
|
model.links = vtkCellLinks.newInstance();
|
|
@@ -33,10 +33,14 @@ function convert(xx, yy, pb, area) {
|
|
|
33
33
|
if (!pb) {
|
|
34
34
|
return 0;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
// console.log(caller);
|
|
38
|
+
// console.log('convert', xx, yy, pb, area);
|
|
36
39
|
const offset = (yy * (area[2] - area[0] + 1) + xx) * 4;
|
|
37
40
|
const r = pb[offset];
|
|
38
41
|
const g = pb[offset + 1];
|
|
39
42
|
const b = pb[offset + 2];
|
|
43
|
+
// console.log(b, g, r, (b * 256 + g) * 256 + r);
|
|
40
44
|
return (b * 256 + g) * 256 + r;
|
|
41
45
|
}
|
|
42
46
|
function getID(low24, high8) {
|
|
@@ -507,16 +511,20 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
|
|
|
507
511
|
publicAPI.getPixelInformation = (inDisplayPosition, maxDistance, outSelectedPosition) => {
|
|
508
512
|
// Base case
|
|
509
513
|
const maxDist = maxDistance < 0 ? 0 : maxDistance;
|
|
514
|
+
console.log('getPixelInformation called', maxDist);
|
|
510
515
|
if (maxDist === 0) {
|
|
511
516
|
outSelectedPosition[0] = inDisplayPosition[0];
|
|
512
517
|
outSelectedPosition[1] = inDisplayPosition[1];
|
|
513
518
|
if (inDisplayPosition[0] < model.area[0] || inDisplayPosition[0] > model.area[2] || inDisplayPosition[1] < model.area[1] || inDisplayPosition[1] > model.area[3]) {
|
|
514
519
|
return null;
|
|
515
520
|
}
|
|
516
|
-
|
|
521
|
+
console.log(inDisplayPosition);
|
|
522
|
+
console.log(model.area);
|
|
517
523
|
// offset inDisplayPosition based on the lower-left-corner of the Area.
|
|
518
524
|
const displayPosition = [inDisplayPosition[0] - model.area[0], inDisplayPosition[1] - model.area[1]];
|
|
525
|
+
console.log('adjusted displayPosition', displayPosition);
|
|
519
526
|
const actorid = convert(displayPosition[0], displayPosition[1], model.pixBuffer[PassTypes.ACTOR_PASS], model.area);
|
|
527
|
+
console.log('actorid', actorid);
|
|
520
528
|
if (actorid <= 0 || actorid - idOffset >= model.props.length) {
|
|
521
529
|
// the pixel did not hit any actor.
|
|
522
530
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitware/vtk.js",
|
|
3
|
-
"version": "34.15.
|
|
3
|
+
"version": "34.15.1",
|
|
4
4
|
"description": "Visualization Toolkit for the Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3d",
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
"karma-junit-reporter": "2.0.1",
|
|
98
98
|
"karma-webpack": "5.0.0",
|
|
99
99
|
"kw-doc": "3.1.2",
|
|
100
|
+
"lil-gui": "0.19.2",
|
|
100
101
|
"lodash": "4.17.21",
|
|
101
102
|
"magic-string": "0.26.2",
|
|
102
103
|
"moment": "2.29.4",
|