@kitware/vtk.js 25.14.0 → 25.14.2
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.
|
@@ -129,8 +129,13 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
|
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
publicAPI.onButtonUp = function (interactor, renderer) {
|
|
132
|
-
if (!previousPosition || !currentPosition) {
|
|
132
|
+
if (!previousPosition || !currentPosition && !model.boxChangeOnClick) {
|
|
133
133
|
return;
|
|
134
|
+
} // needed because of boxChangeOnClick
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
if (!currentPosition) {
|
|
138
|
+
currentPosition = previousPosition;
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
publicAPI.invokeBoxSelectChange({
|
|
@@ -158,6 +163,7 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
|
|
|
158
163
|
function DEFAULT_VALUES(initialValues) {
|
|
159
164
|
return _objectSpread(_objectSpread({
|
|
160
165
|
// container: null,
|
|
166
|
+
boxChangeOnClick: false,
|
|
161
167
|
renderSelection: true
|
|
162
168
|
}, initialValues), {}, {
|
|
163
169
|
selectionStyle: _objectSpread(_objectSpread({}, DEFAULT_STYLE), initialValues.selectionStyle)
|
|
@@ -175,7 +181,7 @@ function extend(publicAPI, model) {
|
|
|
175
181
|
|
|
176
182
|
event(publicAPI, model, 'BoxSelectInput'); // Trigger while dragging
|
|
177
183
|
|
|
178
|
-
setGet(publicAPI, model, ['renderSelection', 'selectionStyle', 'container']); // Object specific methods
|
|
184
|
+
setGet(publicAPI, model, ['renderSelection', 'boxChangeOnClick', 'selectionStyle', 'container']); // Object specific methods
|
|
179
185
|
|
|
180
186
|
vtkMouseBoxSelectionManipulator(publicAPI, model);
|
|
181
187
|
} // ----------------------------------------------------------------------------
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// This is used to access the underlying 3D context
|
|
2
|
+
var GET_UNDERLYING_CONTEXT = '__getUnderlyingContext';
|
|
1
3
|
function createContextProxyHandler() {
|
|
2
4
|
var cache = new Map();
|
|
3
5
|
var getParameterHandler = {
|
|
@@ -41,6 +43,9 @@ function createContextProxyHandler() {
|
|
|
41
43
|
|
|
42
44
|
return {
|
|
43
45
|
get: function get(gl, prop, receiver) {
|
|
46
|
+
if (prop === GET_UNDERLYING_CONTEXT) return function () {
|
|
47
|
+
return gl;
|
|
48
|
+
};
|
|
44
49
|
var value = Reflect.get(gl, prop, gl);
|
|
45
50
|
|
|
46
51
|
if (value instanceof Function) {
|
|
@@ -62,4 +67,4 @@ var ContextProxy = {
|
|
|
62
67
|
createContextProxyHandler: createContextProxyHandler
|
|
63
68
|
};
|
|
64
69
|
|
|
65
|
-
export { createContextProxyHandler, ContextProxy as default };
|
|
70
|
+
export { GET_UNDERLYING_CONTEXT, createContextProxyHandler, ContextProxy as default };
|
|
@@ -12,7 +12,7 @@ import vtkTextureUnitManager from './TextureUnitManager.js';
|
|
|
12
12
|
import vtkViewNodeFactory from './ViewNodeFactory.js';
|
|
13
13
|
import vtkRenderPass from '../SceneGraph/RenderPass.js';
|
|
14
14
|
import vtkRenderWindowViewNode from '../SceneGraph/RenderWindowViewNode.js';
|
|
15
|
-
import { createContextProxyHandler } from './RenderWindow/ContextProxy.js';
|
|
15
|
+
import { createContextProxyHandler, GET_UNDERLYING_CONTEXT } from './RenderWindow/ContextProxy.js';
|
|
16
16
|
|
|
17
17
|
var vtkDebugMacro = macro.vtkDebugMacro,
|
|
18
18
|
vtkErrorMacro = macro.vtkErrorMacro;
|
|
@@ -310,7 +310,8 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
310
310
|
return gl.makeXRCompatible();
|
|
311
311
|
|
|
312
312
|
case 6:
|
|
313
|
-
glLayer = new global.XRWebGLLayer(model.xrSession,
|
|
313
|
+
glLayer = new global.XRWebGLLayer(model.xrSession, // constructor needs unproxied context
|
|
314
|
+
gl[GET_UNDERLYING_CONTEXT]());
|
|
314
315
|
publicAPI.setSize(glLayer.framebufferWidth, glLayer.framebufferHeight);
|
|
315
316
|
model.xrSession.updateRenderState({
|
|
316
317
|
baseLayer: glLayer
|
|
@@ -178,7 +178,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
|
|
|
178
178
|
|
|
179
179
|
if (model.zBufferTexture !== null) {
|
|
180
180
|
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::ZBuffer::Dec', ['uniform sampler2D zBufferTexture;', 'uniform float vpWidth;', 'uniform float vpHeight;']).result;
|
|
181
|
-
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::ZBuffer::Impl', ['vec4 depthVec = texture2D(zBufferTexture, vec2(gl_FragCoord.x / vpWidth, gl_FragCoord.y/vpHeight));', 'float zdepth = (depthVec.r*256.0 + depthVec.g)/257.0;', 'zdepth = zdepth * 2.0 - 1.0;', 'zdepth = -2.0 * camFar * camNear / (zdepth*(camFar-camNear)-(camFar+camNear)) - camNear;', 'zdepth = -zdepth/rayDir.z;', 'dists.y = min(zdepth,dists.y);']).result;
|
|
181
|
+
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::ZBuffer::Impl', ['vec4 depthVec = texture2D(zBufferTexture, vec2(gl_FragCoord.x / vpWidth, gl_FragCoord.y/vpHeight));', 'float zdepth = (depthVec.r*256.0 + depthVec.g)/257.0;', 'zdepth = zdepth * 2.0 - 1.0;', 'if (cameraParallel == 0) {', 'zdepth = -2.0 * camFar * camNear / (zdepth*(camFar-camNear)-(camFar+camNear)) - camNear;}', 'else {', 'zdepth = (zdepth + 1.0) * 0.5 * (camFar - camNear);}\n', 'zdepth = -zdepth/rayDir.z;', 'dists.y = min(zdepth,dists.y);']).result;
|
|
182
182
|
} // Set the BlendMode approach
|
|
183
183
|
|
|
184
184
|
|