@kitware/vtk.js 24.14.0 → 24.14.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.
|
@@ -25,10 +25,19 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
25
25
|
var resizeObserver = new ResizeObserver(function (entries) {
|
|
26
26
|
publicAPI.updateViewport();
|
|
27
27
|
});
|
|
28
|
+
var onCameraChangedSub = null;
|
|
29
|
+
var onCameraModifiedSub = null;
|
|
28
30
|
var onAnimationSub = null;
|
|
29
31
|
var onEndAnimationSub = null;
|
|
30
32
|
var selfSubscription = null;
|
|
31
33
|
|
|
34
|
+
function onCameraModified() {
|
|
35
|
+
// If animating, marker will be updated on Animation event
|
|
36
|
+
if (!model._interactor.isAnimating()) {
|
|
37
|
+
publicAPI.updateMarkerOrientation();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
publicAPI.computeViewport = function () {
|
|
33
42
|
var parentRen = model.parentRenderer || model._interactor.getCurrentRenderer();
|
|
34
43
|
|
|
@@ -147,6 +156,16 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
147
156
|
selfRenderer.setInteractive(false);
|
|
148
157
|
selfRenderer.addViewProp(model.actor);
|
|
149
158
|
model.actor.setVisibility(true);
|
|
159
|
+
onCameraChangedSub = ren.onEvent(function (event) {
|
|
160
|
+
if (event.type === 'ActiveCameraEvent') {
|
|
161
|
+
if (onCameraModifiedSub) {
|
|
162
|
+
onCameraModifiedSub.unsubscribe();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
onCameraModifiedSub = event.camera.onModified(onCameraModified);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
onCameraModifiedSub = ren.getActiveCamera().onModified(onCameraModified);
|
|
150
169
|
onAnimationSub = model._interactor.onAnimation(publicAPI.updateMarkerOrientation);
|
|
151
170
|
onEndAnimationSub = model._interactor.onEndAnimation(publicAPI.updateMarkerOrientation);
|
|
152
171
|
resizeObserver.observe(model._interactor.getView().getCanvas());
|
|
@@ -160,6 +179,10 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
160
179
|
|
|
161
180
|
model.enabled = false;
|
|
162
181
|
resizeObserver.disconnect();
|
|
182
|
+
onCameraChangedSub.unsubscribe();
|
|
183
|
+
onCameraChangedSub = null;
|
|
184
|
+
onCameraModifiedSub.unsubscribe();
|
|
185
|
+
onCameraModifiedSub = null;
|
|
163
186
|
onAnimationSub.unsubscribe();
|
|
164
187
|
onAnimationSub = null;
|
|
165
188
|
onEndAnimationSub.unsubscribe();
|
|
@@ -234,6 +257,16 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
234
257
|
selfSubscription = null;
|
|
235
258
|
}
|
|
236
259
|
|
|
260
|
+
if (onCameraChangedSub) {
|
|
261
|
+
onCameraChangedSub.unsubscribe();
|
|
262
|
+
onCameraChangedSub = null;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (onCameraModifiedSub) {
|
|
266
|
+
onCameraModifiedSub.unsubscribe();
|
|
267
|
+
onCameraModifiedSub = null;
|
|
268
|
+
}
|
|
269
|
+
|
|
237
270
|
if (onAnimationSub) {
|
|
238
271
|
onAnimationSub.unsubscribe();
|
|
239
272
|
onAnimationSub = null;
|
|
@@ -198,7 +198,7 @@ function vtkScalarBarActorHelper(publicAPI, model) {
|
|
|
198
198
|
model.camera = camera;
|
|
199
199
|
model.renderWindow = renderWindow; // did something significant change? If so rebuild a lot of things
|
|
200
200
|
|
|
201
|
-
if (model.forceUpdate || Math.max(scalarsToColors.getMTime(), publicAPI.getMTime()) > model.lastRebuildTime.getMTime()) {
|
|
201
|
+
if (model.forceUpdate || Math.max(scalarsToColors.getMTime(), publicAPI.getMTime(), model.renderable.getMTime()) > model.lastRebuildTime.getMTime()) {
|
|
202
202
|
var range = scalarsToColors.getMappingRange();
|
|
203
203
|
model.lastTickBounds = _toConsumableArray(range); // compute tick marks for axes (update for log scale)
|
|
204
204
|
|
|
@@ -65,7 +65,11 @@ function vtkOpenGLRenderer(publicAPI, model) {
|
|
|
65
65
|
gl.scissor(ts.lowerLeftU, ts.lowerLeftV, ts.usize, ts.vsize);
|
|
66
66
|
gl.viewport(ts.lowerLeftU, ts.lowerLeftV, ts.usize, ts.vsize);
|
|
67
67
|
gl.colorMask(true, true, true, true);
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
if (clearMask) {
|
|
70
|
+
gl.clear(clearMask);
|
|
71
|
+
}
|
|
72
|
+
|
|
69
73
|
gl.enable(gl.DEPTH_TEST);
|
|
70
74
|
}
|
|
71
75
|
}; // Renders myself
|
|
@@ -147,7 +151,11 @@ function vtkOpenGLRenderer(publicAPI, model) {
|
|
|
147
151
|
gl.enable(gl.SCISSOR_TEST);
|
|
148
152
|
gl.scissor(ts.lowerLeftU, ts.lowerLeftV, ts.usize, ts.vsize);
|
|
149
153
|
gl.viewport(ts.lowerLeftU, ts.lowerLeftV, ts.usize, ts.vsize);
|
|
150
|
-
|
|
154
|
+
|
|
155
|
+
if (clearMask) {
|
|
156
|
+
gl.clear(clearMask);
|
|
157
|
+
}
|
|
158
|
+
|
|
151
159
|
gl.enable(gl.DEPTH_TEST);
|
|
152
160
|
/* eslint-enable no-bitwise */
|
|
153
161
|
};
|