Simple measure drag for volume rendering.

This commit is contained in:
Krad
2022-11-16 11:33:31 +08:00
parent c4c762c42e
commit 6c4b5754a0

View File

@@ -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();
}