| 655 | } |
| 656 | |
| 657 | void 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); |
no test coverage detected