@kitware/vtk.js 30.10.0 → 31.0.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.
|
@@ -104,17 +104,18 @@ function vtkFullScreenRenderWindow(publicAPI, model) {
|
|
|
104
104
|
publicAPI.toggleControllerVisibility = () => {
|
|
105
105
|
publicAPI.setControllerVisibility(!model.controllerVisibility);
|
|
106
106
|
};
|
|
107
|
+
function handleKeypress(e) {
|
|
108
|
+
if (String.fromCharCode(e.charCode) === 'c') {
|
|
109
|
+
publicAPI.toggleControllerVisibility();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
107
112
|
publicAPI.addController = html => {
|
|
108
113
|
model.controlContainer = document.createElement('div');
|
|
109
114
|
applyStyle(model.controlContainer, model.controlPanelStyle || STYLE_CONTROL_PANEL);
|
|
110
115
|
model.rootContainer.appendChild(model.controlContainer);
|
|
111
116
|
model.controlContainer.innerHTML = html;
|
|
112
117
|
publicAPI.setControllerVisibility(model.controllerVisibility);
|
|
113
|
-
model.rootContainer.addEventListener('keypress',
|
|
114
|
-
if (String.fromCharCode(e.charCode) === 'c') {
|
|
115
|
-
publicAPI.toggleControllerVisibility();
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
+
model.rootContainer.addEventListener('keypress', handleKeypress);
|
|
118
119
|
};
|
|
119
120
|
|
|
120
121
|
// Update BG color
|
|
@@ -131,7 +132,10 @@ function vtkFullScreenRenderWindow(publicAPI, model) {
|
|
|
131
132
|
};
|
|
132
133
|
|
|
133
134
|
// Properly release GL context
|
|
134
|
-
publicAPI.delete = macro.chain(publicAPI.setContainer, model.apiSpecificRenderWindow.delete,
|
|
135
|
+
publicAPI.delete = macro.chain(publicAPI.setContainer, model.apiSpecificRenderWindow.delete, () => {
|
|
136
|
+
model.rootContainer?.removeEventListener('keypress', handleKeypress);
|
|
137
|
+
window.removeEventListener('resize', publicAPI.resize);
|
|
138
|
+
}, publicAPI.delete);
|
|
135
139
|
|
|
136
140
|
// Handle window resize
|
|
137
141
|
publicAPI.resize = () => {
|
|
@@ -68,7 +68,9 @@ function vtkGenericRenderWindow(publicAPI, model) {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// Properly release GL context
|
|
71
|
-
publicAPI.delete = macro.chain(publicAPI.setContainer, model._apiSpecificRenderWindow.delete,
|
|
71
|
+
publicAPI.delete = macro.chain(publicAPI.setContainer, model._apiSpecificRenderWindow.delete, () => {
|
|
72
|
+
window.removeEventListener('resize', publicAPI.resize);
|
|
73
|
+
}, publicAPI.delete);
|
|
72
74
|
|
|
73
75
|
// Handle size
|
|
74
76
|
if (model.listenWindowResize) {
|
|
@@ -113,7 +113,7 @@ function vtkOpenGLActor(publicAPI, model) {
|
|
|
113
113
|
// Renders myself
|
|
114
114
|
publicAPI.translucentPass = (prepass, renderPass) => {
|
|
115
115
|
if (prepass) {
|
|
116
|
-
model.context.depthMask(
|
|
116
|
+
model.context.depthMask(model._openGLRenderer.getSelector() && model.renderable.getNestedPickable());
|
|
117
117
|
publicAPI.activateTextures();
|
|
118
118
|
} else if (model.activeTextures) {
|
|
119
119
|
for (let index = 0; index < model.activeTextures.length; index++) {
|