| 713 | } |
| 714 | |
| 715 | void 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 | } |
no test coverage detected