diff --git a/src/src/Interaction/VolumeInteractorStyle.cpp b/src/src/Interaction/VolumeInteractorStyle.cpp index 8a745e1..edd44a7 100644 --- a/src/src/Interaction/VolumeInteractorStyle.cpp +++ b/src/src/Interaction/VolumeInteractorStyle.cpp @@ -45,8 +45,10 @@ void VolumeInteractorStyle::OnLeftButtonDown() { this->GrabFocus(this->EventCallbackCommand); // un select last selected prop if (CurrentProp) { - CurrentProp->InvokeEvent(DraggableActor::DraggableActorEvents::UnSelectedEvent); - CurrentProp = nullptr; + DragStartOrigin[0] = x; + DragStartOrigin[1] = y; + this->StartDrag(); + return; } if (measure) { measure->SetPlacing(measure->onMeasureLeftButtonDown(this->Interactor)); @@ -157,6 +159,10 @@ void VolumeInteractorStyle::OnMouseMove() { this->WindowLevel(); this->InvokeEvent(vtkCommand::InteractionEvent, nullptr); break; + case VTKIS_DRAG: + Drag(); + this->InvokeEvent(vtkCommand::InteractionEvent, nullptr); + break; case VTKIS_MEASURE: MeasurePlace(); // this->InvokeEvent(vtkCommand::InteractionEvent, nullptr); @@ -321,7 +327,7 @@ void VolumeInteractorStyle::GetCurrentVolumeProperty() { void VolumeInteractorStyle::Drag() { int *pos = this->Interactor->GetEventPosition(); this->FindPokedRenderer(pos[0], pos[1]); - DraggableActor::SafeDownCast(dragProp)->Transform(pos[0] - DragStartOrigin[0], pos[1] - DragStartOrigin[1]); + DraggableActor::SafeDownCast(CurrentProp)->Transform(pos[0] - DragStartOrigin[0], pos[1] - DragStartOrigin[1]); this->Interactor->Render(); }