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

Method OnRightButtonDown

Interaction/Widgets/vtkSplineWidget.cxx:715–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713}
714
715void vtkSplineWidget::OnRightButtonDown()
716{
717 int X = this->Interactor->GetEventPosition()[0];
718 int Y = this->Interactor->GetEventPosition()[1];
719
720 // Okay, make sure that the pick is in the current renderer
721 if (!this->CurrentRenderer || !this->CurrentRenderer->IsInViewport(X, Y))
722 {
723 this->State = vtkSplineWidget::Outside;
724 return;
725 }
726
727 if (this->Interactor->GetShiftKey())
728 {
729 this->State = vtkSplineWidget::Inserting;
730 }
731 else if (this->Interactor->GetControlKey())
732 {
733 this->State = vtkSplineWidget::Erasing;
734 }
735 else
736 {
737 this->State = vtkSplineWidget::Scaling;
738 }
739
740 vtkAssemblyPath* path = this->GetAssemblyPath(X, Y, 0., this->HandlePicker);
741
742 if (path != nullptr)
743 {
744 switch (this->State)
745 {
746 // deny insertion over existing handles
747 case vtkSplineWidget::Inserting:
748 this->State = vtkSplineWidget::Outside;
749 return;
750 case vtkSplineWidget::Erasing:
751 this->CurrentHandleIndex = this->HighlightHandle(path->GetFirstNode()->GetViewProp());
752 break;
753 case vtkSplineWidget::Scaling:
754 this->HighlightLine(1);
755 break;
756 }
757 }
758 else
759 {
760 // trying to erase handle but nothing picked
761 if (this->State == vtkSplineWidget::Erasing)
762 {
763 this->State = vtkSplineWidget::Outside;
764 return;
765 }
766 // try to insert or scale so pick the line
767 path = this->GetAssemblyPath(X, Y, 0., this->LinePicker);
768
769 if (path != nullptr)
770 {
771 this->HighlightLine(1);
772 }

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