diff --git a/src/src/Interaction/ActorDraggableInteractorStyle.cpp b/src/src/Interaction/ActorDraggableInteractorStyle.cpp index 706c2ed..75f3657 100644 --- a/src/src/Interaction/ActorDraggableInteractorStyle.cpp +++ b/src/src/Interaction/ActorDraggableInteractorStyle.cpp @@ -74,14 +74,17 @@ void ActorDraggableInteractorStyle::OnLeftButtonDown() { if (dragProp) { selectedProp = dragProp; selectedProp->InvokeEvent(DraggableActor::DraggableActorEvents::SelectedEvent); + #if VTK_MAJOR_VERSION<9 if (this->Interactor->GetRepeatCount()) { dragProp->InvokeEvent(DraggableStyleEvents::PopPropEvent, nullptr); } + #endif DragStartOrigin[0] = x; DragStartOrigin[1] = y; this->StartDrag(); return; } + #if VTK_MAJOR_VERSION<9 if (Interactor->GetRepeatCount()) { if (measure) { measure->SetPlacing(measure->onMeasureDoubleClick(this->Interactor)); @@ -101,6 +104,7 @@ void ActorDraggableInteractorStyle::OnLeftButtonDown() { return; } } + #endif if (measure) { measure->SetPlacing(measure->onMeasureLeftButtonDown(this->Interactor)); if (this->State != VTKIS_MEASURE) this->StartMeasure(); @@ -113,8 +117,6 @@ void ActorDraggableInteractorStyle::OnLeftButtonDown() { this->StartColorMapping(); return; } - - if (this->InteractionMode == VTKIS_IMAGE_WINDOWLEVEL) { this->WindowLevelStartPosition[0] = x; this->WindowLevelStartPosition[1] = y; @@ -130,6 +132,31 @@ void ActorDraggableInteractorStyle::OnLeftButtonDown() { } +#if VTK_MAJOR_VERSION>=9 +void ActorDraggableInteractorStyle::OnLeftButtonDoubleClick() { + if (dragProp) { + dragProp->InvokeEvent(DraggableStyleEvents::PopPropEvent, nullptr); + } + if (measure) { + measure->SetPlacing(measure->onMeasureDoubleClick(this->Interactor)); + if (!measure->isMeasurePlacing()) { + this->EndMeasure(); + auto temp = measure; + measure = measure->GetNextMeasure(); + if (!temp->Valid()) { + temp->ForceDelete(); + temp = nullptr; + } + } + return; + } + if (!scalarProp) { + this->InvokeEvent(DraggableStyleEvents::DoubleClickEvent, nullptr); + return; + } +} +#endif + void ActorDraggableInteractorStyle::OnLeftButtonUp() { switch (this->State) { case VTKIS_DRAG: @@ -544,3 +571,4 @@ void ActorDraggableInteractorStyle::DispatchEvent() { } + diff --git a/src/src/Interaction/ActorDraggableInteractorStyle.h b/src/src/Interaction/ActorDraggableInteractorStyle.h index 09f5fff..bcd4cd8 100644 --- a/src/src/Interaction/ActorDraggableInteractorStyle.h +++ b/src/src/Interaction/ActorDraggableInteractorStyle.h @@ -13,8 +13,11 @@ #include "functional" #include "vtkCornerAnnotation.h" #include "vtkCommand.h" +#include + #include "Rendering/Core/RenderingDefines.h" + class vtkProp; class Measure; @@ -41,6 +44,10 @@ vtkTypeMacro(ActorDraggableInteractorStyle, vtkInteractorStyleImage); */ void OnRightButtonDown() override; + #if VTK_MAJOR_VERSION>=9 + void OnLeftButtonDoubleClick() override; + #endif + void OnLeftButtonDown() override; /**