diff --git a/src/src/Interaction/ActorDraggableInteractorStyle.cpp b/src/src/Interaction/ActorDraggableInteractorStyle.cpp index 45d1446..037159d 100644 --- a/src/src/Interaction/ActorDraggableInteractorStyle.cpp +++ b/src/src/Interaction/ActorDraggableInteractorStyle.cpp @@ -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() { diff --git a/src/src/Interaction/ActorDraggableInteractorStyle.h b/src/src/Interaction/ActorDraggableInteractorStyle.h index bcefbef..d25c4ce 100644 --- a/src/src/Interaction/ActorDraggableInteractorStyle.h +++ b/src/src/Interaction/ActorDraggableInteractorStyle.h @@ -42,6 +42,9 @@ vtkTypeMacro(ActorDraggableInteractorStyle, vtkInteractorStyleImage); */ void OnRightButtonDown() override; + void OnRightButtonUp() override; + + #if VTK_MAJOR_VERSION>=9 void OnLeftButtonDoubleClick() override; #endif