# How to define my own interactorstyle of vtkplanewidget?

**URL:** https://discourse.vtk.org/t/how-to-define-my-own-interactorstyle-of-vtkplanewidget/11643
**Category:** Development
**Tags:** code
**Created:** [June 8, 2023, 1:58pm UTC](https://discourse.vtk.org/t/how-to-define-my-own-interactorstyle-of-vtkplanewidget/11643 "2023-06-08T13:58:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)
#### Post date: [June 8, 2023, 1:58pm UTC](https://discourse.vtk.org/t/how-to-define-my-own-interactorstyle-of-vtkplanewidget/11643/1 "2023-06-08T13:58:54Z")

</div>

I use vtkPlanewidget to add a plane widget in the rendering window. The default interaction style of this plane widget is to select the plane with the left mouse button to translate the plane, and to select the normal axis with the left mouse button to change the normal vector of the plane.  
But I want to customize the interaction method of the plane widget, such as clicking the plane part of the plane component, the plane can change its direction and be parallel to the display screen, and the left mouse button (the default is the middle button) clicks on the normal axis to translate the plane in the normal direction part.

---

<div class="post-metadata">

### Author: ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)
#### Post date: [June 8, 2023, 2:01pm UTC](https://discourse.vtk.org/t/how-to-define-my-own-interactorstyle-of-vtkplanewidget/11643/2 "2023-06-08T14:01:09Z")

</div>

any sugesstion would be helpful~

---

<div class="post-metadata">

### Author: ![Alex\_Vergara](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alex_vergara/32/7082_2.png) [@Alex\_Vergara](https://discourse.vtk.org/u/Alex_Vergara)
#### Post date: [June 9, 2023, 12:20pm UTC](https://discourse.vtk.org/t/how-to-define-my-own-interactorstyle-of-vtkplanewidget/11643/3 "2023-06-09T12:20:05Z")

</div>

Since you don’t say anything else, this is how I did mine in JavaScript

> [@help setting Manipulator Style](https://discourse.vtk.org/t/help-setting-manipulator-style/11583):
>
> Hello I need help setting a specific Manipulator style in vtk.js, so far I have written function getInteractorStyle(){ // Interactor (view https://kitware.github.io/vtk-js/examples/InteractorStyleManipulator.html) const interactorStyleDefinitions = { // To be used by vtkInteractorStyleManipulator // Pan on Middle button drag and on Shift + Left button drag Pan: { klass: vtk.Interaction.Manipulators.vtkMouseCameraTrackballPanManipulator, options: [ { button: 2 }, …

---

<div class="post-metadata">

### Author: ![Dylan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dylan/32/7822_2.png) [@Dylan](https://discourse.vtk.org/u/Dylan)
#### Post date: [June 11, 2023, 10:53am UTC](https://discourse.vtk.org/t/how-to-define-my-own-interactorstyle-of-vtkplanewidget/11643/4 "2023-06-11T10:53:23Z")

</div>

I changed the source code of vtkPlaneWidget.cxx ， it worked.  
thank you very much!
