------------------------------------------------------------------------------
| 587 | |
| 588 | //------------------------------------------------------------------------------ |
| 589 | void vtkLineWidget::OnLeftButtonDown() |
| 590 | { |
| 591 | int forward = 0; |
| 592 | |
| 593 | int X = this->Interactor->GetEventPosition()[0]; |
| 594 | int Y = this->Interactor->GetEventPosition()[1]; |
| 595 | |
| 596 | // Okay, make sure that the pick is in the current renderer |
| 597 | if (!this->CurrentRenderer || !this->CurrentRenderer->IsInViewport(X, Y)) |
| 598 | { |
| 599 | this->State = vtkLineWidget::Outside; |
| 600 | return; |
| 601 | } |
| 602 | |
| 603 | // Okay, we can process this. Try to pick handles first; |
| 604 | // if no handles picked, then try to pick the line. |
| 605 | vtkAssemblyPath* path = this->GetAssemblyPath(X, Y, 0., this->HandlePicker); |
| 606 | |
| 607 | if (path != nullptr) |
| 608 | { |
| 609 | this->EventCallbackCommand->SetAbortFlag(1); |
| 610 | this->StartInteraction(); |
| 611 | this->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr); |
| 612 | this->State = vtkLineWidget::MovingHandle; |
| 613 | this->HighlightHandle(path->GetFirstNode()->GetViewProp()); |
| 614 | this->EnablePointWidget(); |
| 615 | forward = this->ForwardEvent(vtkCommand::LeftButtonPressEvent); |
| 616 | } |
| 617 | else |
| 618 | { |
| 619 | path = this->GetAssemblyPath(X, Y, 0., this->LinePicker); |
| 620 | |
| 621 | if (path != nullptr) |
| 622 | { |
| 623 | this->EventCallbackCommand->SetAbortFlag(1); |
| 624 | this->StartInteraction(); |
| 625 | this->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr); |
| 626 | this->State = vtkLineWidget::MovingLine; |
| 627 | this->HighlightLine(1); |
| 628 | this->EnablePointWidget(); |
| 629 | forward = this->ForwardEvent(vtkCommand::LeftButtonPressEvent); |
| 630 | } |
| 631 | else |
| 632 | { |
| 633 | this->State = vtkLineWidget::Outside; |
| 634 | this->HighlightHandle(nullptr); |
| 635 | return; |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | if (!forward) |
| 640 | { |
| 641 | this->Interactor->Render(); |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | //------------------------------------------------------------------------------ |
| 646 | void vtkLineWidget::OnLeftButtonUp() |
no test coverage detected