MCPcopy Create free account
hub / github.com/Kitware/VTK / OnMiddleButtonDown

Method OnMiddleButtonDown

Interaction/Widgets/vtkLineWidget.cxx:672–728  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

670
671//------------------------------------------------------------------------------
672void vtkLineWidget::OnMiddleButtonDown()
673{
674 int forward = 0;
675
676 int X = this->Interactor->GetEventPosition()[0];
677 int Y = this->Interactor->GetEventPosition()[1];
678
679 // Okay, make sure that the pick is in the current renderer
680 if (!this->CurrentRenderer || !this->CurrentRenderer->IsInViewport(X, Y))
681 {
682 this->State = vtkLineWidget::Outside;
683 return;
684 }
685
686 // Okay, we can process this. Try to pick handles first;
687 // if no handles picked, then pick the bounding box.
688 vtkAssemblyPath* path = this->GetAssemblyPath(X, Y, 0., this->HandlePicker);
689
690 if (path != nullptr)
691 {
692 this->EventCallbackCommand->SetAbortFlag(1);
693 this->StartInteraction();
694 this->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
695 this->State = vtkLineWidget::MovingLine;
696 this->HighlightHandles(1);
697 this->HighlightLine(1);
698 this->EnablePointWidget();
699 forward = this->ForwardEvent(vtkCommand::LeftButtonPressEvent);
700 }
701 else
702 {
703 path = this->GetAssemblyPath(X, Y, 0., this->LinePicker);
704
705 if (path != nullptr)
706 {
707 this->EventCallbackCommand->SetAbortFlag(1);
708 this->StartInteraction();
709 this->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
710 // The highlight methods set the LastPickPosition, so they are ordered
711 this->HighlightHandles(1);
712 this->HighlightLine(1);
713 this->State = vtkLineWidget::MovingLine;
714 this->EnablePointWidget();
715 forward = this->ForwardEvent(vtkCommand::LeftButtonPressEvent);
716 }
717 else
718 {
719 this->State = vtkLineWidget::Outside;
720 return;
721 }
722 }
723
724 if (!forward)
725 {
726 this->Interactor->Render();
727 }
728}
729

Callers 1

ProcessEventsMethod · 0.95

Calls 9

HighlightHandlesMethod · 0.95
HighlightLineMethod · 0.95
EnablePointWidgetMethod · 0.95
ForwardEventMethod · 0.95
IsInViewportMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65
GetAssemblyPathMethod · 0.45
StartInteractionMethod · 0.45

Tested by

no test coverage detected