From 230e8bf1312d51678436251e96c4b0b411b8e1f1 Mon Sep 17 00:00:00 2001 From: idoRosen25 Date: Tue, 8 Nov 2022 16:39:21 +0200 Subject: [PATCH] feat(itkVtkViewProxy): add touch camera manipulator --- src/Rendering/VTKJS/createRenderer.js | 22 +++++++++++-------- src/UI/Images/transferFunctionManipulators.js | 3 ++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Rendering/VTKJS/createRenderer.js b/src/Rendering/VTKJS/createRenderer.js index e3e3e617e..88e3aedf7 100644 --- a/src/Rendering/VTKJS/createRenderer.js +++ b/src/Rendering/VTKJS/createRenderer.js @@ -1,5 +1,4 @@ -// import vtkProxyManager from 'vtk.js/Sources/Proxy/Core/ProxyManager' -// import proxyConfiguration from './proxyManagerConfiguration' +import vtkGestureCameraManipulator from 'vtk.js/Sources/Interaction/Manipulators/GestureCameraManipulator' import createMainRenderer from './Main/createMainRenderer' // Load the rendering pieces we want to use (for both WebGL and WebGPU) @@ -8,13 +7,6 @@ import 'vtk.js/Sources/Rendering/Profiles/Glyph' import 'vtk.js/Sources/Rendering/Profiles/Volume' function createRenderer(context) { - //const proxyManager = vtkProxyManager.newInstance({ proxyConfiguration }) - //context.proxyManager = proxyManager - //window.addEventListener('resize', proxyManager.resizeAllViews) - - //context.itkVtkView = proxyManager.createProxy('Views', 'ItkVtkView') - //context.renderWindow = context.itkVtkView.getRenderWindow() - context.itkVtkView.setContainer(context.renderingViewContainers.get('volume')) context.itkVtkView.setXyLowerLeft(context.xyLowerLeft) @@ -22,6 +14,18 @@ function createRenderer(context) { const interactor = context.itkVtkView.getInteractor() interactor.onRenderEvent(() => context.service.send('POST_RENDER')) + + const gestureManipulator = vtkGestureCameraManipulator.newInstance({ + pinchEnabled: true, + rotateEnabled: true, + panEnabled: true, + }) + context.itkVtkView + .getInteractorStyle2D() + .addGestureManipulator(gestureManipulator) + context.itkVtkView + .getInteractorStyle3D() + .addGestureManipulator(gestureManipulator) } export default createRenderer diff --git a/src/UI/Images/transferFunctionManipulators.js b/src/UI/Images/transferFunctionManipulators.js index 68866d301..b007db312 100644 --- a/src/UI/Images/transferFunctionManipulators.js +++ b/src/UI/Images/transferFunctionManipulators.js @@ -1,4 +1,5 @@ -import vtkMouseRangeManipulator from '@kitware/vtk.js/Interaction/Manipulators/MouseRangeManipulator' +import vtkMouseRangeManipulator from 'vtk.js/Sources/Interaction/Manipulators/MouseRangeManipulator' + const MIN_WINDOW = 1e-8 const MIN_WIDTH = 1e-8