| 552 | } |
| 553 | |
| 554 | void vtkBoxWidget::OnLeftButtonDown() |
| 555 | { |
| 556 | int X = this->Interactor->GetEventPosition()[0]; |
| 557 | int Y = this->Interactor->GetEventPosition()[1]; |
| 558 | |
| 559 | // Okay, we can process this. Try to pick handles first; |
| 560 | // if no handles picked, then pick the bounding box. |
| 561 | if (!this->CurrentRenderer || !this->CurrentRenderer->IsInViewport(X, Y)) |
| 562 | { |
| 563 | this->State = vtkBoxWidget::Outside; |
| 564 | return; |
| 565 | } |
| 566 | |
| 567 | vtkAssemblyPath* path = this->GetAssemblyPath(X, Y, 0., this->HandlePicker); |
| 568 | |
| 569 | if (path != nullptr) |
| 570 | { |
| 571 | this->State = vtkBoxWidget::Moving; |
| 572 | this->HighlightFace(this->HighlightHandle(path->GetFirstNode()->GetViewProp())); |
| 573 | this->HandlePicker->GetPickPosition(this->LastPickPosition); |
| 574 | this->ValidPick = 1; |
| 575 | } |
| 576 | else |
| 577 | { |
| 578 | path = this->GetAssemblyPath(X, Y, 0., this->HexPicker); |
| 579 | |
| 580 | if (path != nullptr) |
| 581 | { |
| 582 | this->State = vtkBoxWidget::Moving; |
| 583 | this->HexPicker->GetPickPosition(this->LastPickPosition); |
| 584 | this->ValidPick = 1; |
| 585 | if (!this->Interactor->GetShiftKey()) |
| 586 | { |
| 587 | this->HighlightHandle(nullptr); |
| 588 | this->HighlightFace(this->HexPicker->GetCellId()); |
| 589 | } |
| 590 | else |
| 591 | { |
| 592 | this->CurrentHandle = this->Handle[6]; |
| 593 | this->HighlightOutline(1); |
| 594 | } |
| 595 | } |
| 596 | else |
| 597 | { |
| 598 | this->HighlightFace(this->HighlightHandle(nullptr)); |
| 599 | this->State = vtkBoxWidget::Outside; |
| 600 | return; |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | this->EventCallbackCommand->SetAbortFlag(1); |
| 605 | this->StartInteraction(); |
| 606 | this->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr); |
| 607 | this->Interactor->Render(); |
| 608 | } |
| 609 | |
| 610 | void vtkBoxWidget::OnLeftButtonUp() |
| 611 | { |
no test coverage detected