Skip to content

Commit

Permalink
feat(itkVtkViewProxy): add touch camera manipulator
Browse files Browse the repository at this point in the history
  • Loading branch information
idoRosen25 authored and Jmennius committed Dec 13, 2022
1 parent 45f5822 commit 230e8bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
22 changes: 13 additions & 9 deletions src/Rendering/VTKJS/createRenderer.js
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -8,20 +7,25 @@ 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)

createMainRenderer(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
3 changes: 2 additions & 1 deletion src/UI/Images/transferFunctionManipulators.js
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 230e8bf

Please sign in to comment.