@kitware/vtk.js 24.0.2 → 24.0.3

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.
@@ -112,26 +112,18 @@ function vtkOpenGLOrderIndependentTranslucentPass(publicAPI, model) {
112
112
  }
113
113
 
114
114
  var size = viewNode.getSize();
115
- var gl = viewNode.getContext();
116
-
117
- if (gl === null) {
118
- // nothing to do -> no render context
119
- // traverse delegate passes -> has to be done in order for the vtk render-pipeline to work correctly
120
- model.delegates.forEach(function (val) {
121
- val.traverse(viewNode, publicAPI);
122
- });
123
- return;
124
- } // if we lack the webgl2 and half floatsupport just do
115
+ var gl = viewNode.getContext(); // if we lack the webgl2 and half floatsupport just do
125
116
  // basic alpha blending
126
117
 
118
+ model._supported = false;
127
119
 
128
- if (!viewNode.getWebgl2() || !gl.getExtension('EXT_color_buffer_half_float') && !gl.getExtension('EXT_color_buffer_float')) {
129
- console.log('fallback');
120
+ if (!gl || !viewNode.getWebgl2() || !gl.getExtension('EXT_color_buffer_half_float') && !gl.getExtension('EXT_color_buffer_float')) {
130
121
  publicAPI.setCurrentOperation('translucentPass');
131
122
  renNode.traverse(publicAPI);
132
123
  return;
133
- } // prepare framebuffer // allocate framebuffer if needed and bind it
124
+ }
134
125
 
126
+ model._supported = true; // prepare framebuffer // allocate framebuffer if needed and bind it
135
127
 
136
128
  if (model.framebuffer === null) {
137
129
  publicAPI.createFramebuffer(viewNode);
@@ -216,7 +208,11 @@ function vtkOpenGLOrderIndependentTranslucentPass(publicAPI, model) {
216
208
  };
217
209
 
218
210
  publicAPI.getShaderReplacement = function () {
219
- return translucentShaderReplacement;
211
+ if (model._supported) {
212
+ return translucentShaderReplacement;
213
+ }
214
+
215
+ return {};
220
216
  };
221
217
 
222
218
  publicAPI.releaseGraphicsResources = function (viewNode) {
@@ -16,6 +16,11 @@ function vtkSVGLandmarkRepresentation(publicAPI, model) {
16
16
 
17
17
  publicAPI.render = function () {
18
18
  var list = publicAPI.getRepresentationStates();
19
+
20
+ if (!list.length) {
21
+ return createSvgElement('g');
22
+ }
23
+
19
24
  var coords = [];
20
25
  var texts = [];
21
26
  list.forEach(function (state, index) {
@@ -58,6 +63,8 @@ function vtkSVGLandmarkRepresentation(publicAPI, model) {
58
63
  var splitText = texts[i].split('\n');
59
64
  var fontSize = fontSizeToPixels(model.fontProperties);
60
65
  splitText.forEach(function (subText, j) {
66
+ var _model$textProps, _model$textProps2;
67
+
61
68
  var text = publicAPI.createListenableSvgElement('text', i);
62
69
  Object.keys(model.textProps || {}).forEach(function (prop) {
63
70
  text.setAttribute(prop, model.textProps[prop]);
@@ -65,9 +72,9 @@ function vtkSVGLandmarkRepresentation(publicAPI, model) {
65
72
  text.setAttribute('x', x);
66
73
  text.setAttribute('y', y); // Vertical offset (dy) calculation based on VerticalTextAlignment
67
74
 
68
- var dy = model.textProps.dy ? model.textProps.dy : 0;
75
+ var dy = ((_model$textProps = model.textProps) === null || _model$textProps === void 0 ? void 0 : _model$textProps.dy) || 0;
69
76
 
70
- switch (model.textProps.verticalAlign) {
77
+ switch ((_model$textProps2 = model.textProps) === null || _model$textProps2 === void 0 ? void 0 : _model$textProps2.verticalAlign) {
71
78
  case VerticalTextAlignment.MIDDLE:
72
79
  dy -= fontSize * (0.5 * splitText.length - j - 1);
73
80
  break;
package/index.d.ts CHANGED
@@ -76,8 +76,8 @@
76
76
  /// <reference path="./IO/Geometry/DracoReader.d.ts" />
77
77
  /// <reference path="./IO/Geometry/PLYReader.d.ts" />
78
78
  /// <reference path="./IO/Geometry/PLYWriter.d.ts" />
79
- /// <reference path="./IO/Geometry/STLWriter.d.ts" />
80
79
  /// <reference path="./IO/Geometry/STLReader.d.ts" />
80
+ /// <reference path="./IO/Geometry/STLWriter.d.ts" />
81
81
  /// <reference path="./IO/Misc/ElevationReader.d.ts" />
82
82
  /// <reference path="./IO/Misc/ITKImageReader.d.ts" />
83
83
  /// <reference path="./IO/Misc/ITKPolyDataReader.d.ts" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "24.0.2",
3
+ "version": "24.0.3",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",
@@ -87,7 +87,7 @@
87
87
  "html-webpack-plugin": "5.5.0",
88
88
  "husky": "7.0.4",
89
89
  "ignore-loader": "0.1.2",
90
- "karma": "6.3.10",
90
+ "karma": "6.3.17",
91
91
  "karma-chrome-launcher": "3.1.0",
92
92
  "karma-coverage": "2.1.0",
93
93
  "karma-firefox-launcher": "2.1.2",