feat: add mouse right button gesture

This commit is contained in:
kradchen
2025-07-07 10:17:49 +08:00
parent 08143d46b8
commit fffa3de358
2 changed files with 38 additions and 0 deletions

View File

@@ -204,6 +204,41 @@ void ActorDraggableInteractorStyle::OnRightButtonDown() {
if (dragProp) {
dragProp->InvokeEvent(DraggableStyleEvents::RightButtonClickEvent, this->Interactor);
}
if (this->InteractionMode == VTKIS_IMAGE_WINDOWLEVEL) {
this->DollyStartScale = this->CurrentRenderer->GetActiveCamera()->GetParallelScale();
this->StartDolly();
} else if (this->InteractionMode == VTKIS_IMAGE_ZOOM) {
this->StartPan();
} else if (this->InteractionMode == VTKIS_IMAGE_PAN) {
this->DollyStartScale = this->CurrentRenderer->GetActiveCamera()->GetParallelScale();
this->StartDolly();
} else if (this->InteractionMode == VTKIS_IMAGE_SLICING) {
this->WindowLevelStartPosition[0] = x;
this->WindowLevelStartPosition[1] = y;
this->StartWindowLevel();
}
else if(this->InteractionMode == VTKIS_SYNCPOINT){
this->WindowLevelStartPosition[0] = x;
this->WindowLevelStartPosition[1] = y;
this->StartWindowLevel();
}
}
void ActorDraggableInteractorStyle::OnRightButtonUp() {
switch (this->State) {
case VTKIS_IMAGE_WINDOWLEVEL:
case VTKIS_IMAGE_PAN:
this->EndDolly();
break;
case VTKIS_IMAGE_ZOOM:
this->EndPan();
break;
case VTKIS_IMAGE_SLICING:
case VTKIS_SYNCPOINT:
this->EndWindowLevel();
break;
}
vtkInteractorStyleImage::OnLeftButtonUp();
}
void ActorDraggableInteractorStyle::OnMouseMove() {

View File

@@ -42,6 +42,9 @@ vtkTypeMacro(ActorDraggableInteractorStyle, vtkInteractorStyleImage);
*/
void OnRightButtonDown() override;
void OnRightButtonUp() override;
#if VTK_MAJOR_VERSION>=9
void OnLeftButtonDoubleClick() override;
#endif