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

Method OnRightButtonDown

Interaction/Widgets/vtkBrokenLineWidget.cxx:657–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655}
656
657void vtkBrokenLineWidget::OnRightButtonDown()
658{
659 int X = this->Interactor->GetEventPosition()[0];
660 int Y = this->Interactor->GetEventPosition()[1];
661
662 // Okay, make sure that the pick is in the current renderer
663 if (!this->CurrentRenderer || !this->CurrentRenderer->IsInViewport(X, Y))
664 {
665 this->State = vtkBrokenLineWidget::Outside;
666 return;
667 }
668
669 if (this->Interactor->GetShiftKey())
670 {
671 this->State = vtkBrokenLineWidget::Inserting;
672 }
673 else if (this->Interactor->GetControlKey())
674 {
675 this->State = vtkBrokenLineWidget::Erasing;
676 }
677 else
678 {
679 this->State = vtkBrokenLineWidget::Scaling;
680 }
681
682 vtkAssemblyPath* path = this->GetAssemblyPath(X, Y, 0., this->HandlePicker);
683
684 if (path != nullptr)
685 {
686 switch (this->State)
687 {
688 // deny insertion over existing handles
689 case vtkBrokenLineWidget::Inserting:
690 this->State = vtkBrokenLineWidget::Outside;
691 return;
692 case vtkBrokenLineWidget::Erasing:
693 this->CurrentHandleIndex = this->HighlightHandle(path->GetFirstNode()->GetViewProp());
694 break;
695 case vtkBrokenLineWidget::Scaling:
696 this->HighlightLine(1);
697 break;
698 }
699 }
700 else
701 {
702 // trying to erase handle but nothing picked
703 if (this->State == vtkBrokenLineWidget::Erasing)
704 {
705 this->State = vtkBrokenLineWidget::Outside;
706 return;
707 }
708
709 // try to insert or scale so pick the line
710 path = this->GetAssemblyPath(X, Y, 0., this->LinePicker);
711
712 if (path != nullptr)
713 {
714 this->HighlightLine(1);

Callers 1

ProcessEventsHandlerMethod · 0.95

Calls 9

HighlightHandleMethod · 0.95
HighlightLineMethod · 0.95
IsInViewportMethod · 0.80
GetFirstNodeMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65
GetAssemblyPathMethod · 0.45
GetViewPropMethod · 0.45
StartInteractionMethod · 0.45

Tested by

no test coverage detected