------------------------------------------------------------------------------
| 654 | |
| 655 | //------------------------------------------------------------------------------ |
| 656 | bool vtkChartParallelCoordinates::MouseButtonPressEvent(const vtkContextMouseEvent& mouse) |
| 657 | { |
| 658 | if (mouse.GetButton() == this->Actions.Select()) |
| 659 | { |
| 660 | int selectionMode = this->GetSelectionModeFromMouseModifiers(mouse); |
| 661 | this->SetSelectionMode(selectionMode); |
| 662 | |
| 663 | // Select an axis if we are within range |
| 664 | if (mouse.GetScenePos()[1] > this->Point1[1] && mouse.GetScenePos()[1] < this->Point2[1]) |
| 665 | { |
| 666 | // Iterate over the axes, see if we are within 10 pixels of an axis |
| 667 | for (size_t i = 0; i < this->Storage->Axes.size(); ++i) |
| 668 | { |
| 669 | vtkAxis* axis = this->Storage->Axes[i]; |
| 670 | if (axis->GetPoint1()[0] - 10 < mouse.GetScenePos()[0] && |
| 671 | axis->GetPoint1()[0] + 10 > mouse.GetScenePos()[0]) |
| 672 | { |
| 673 | this->Storage->CurrentAxis = static_cast<int>(i); |
| 674 | |
| 675 | if (this->GetSelectionMode() == vtkContextScene::SELECTION_DEFAULT && |
| 676 | this->Storage->ShouldClearCurrentAxeSelection) |
| 677 | { |
| 678 | this->ResetAxeSelection(this->Storage->CurrentAxis); |
| 679 | this->Storage->ShouldClearCurrentAxeSelection = false; |
| 680 | } |
| 681 | |
| 682 | // This is a manual interactive selection |
| 683 | this->Storage->InteractiveSelection = true; |
| 684 | |
| 685 | // Transform into normalized coordinates |
| 686 | float low = mouse.GetScenePos()[1]; |
| 687 | low -= this->Storage->Transform->GetMatrix()->GetElement(1, 2); |
| 688 | low /= this->Storage->Transform->GetMatrix()->GetElement(1, 1); |
| 689 | std::array<float, 2>& range = this->Storage->CurrentSelection; |
| 690 | range[0] = range[1] = low; |
| 691 | |
| 692 | this->Scene->SetDirty(true); |
| 693 | return true; |
| 694 | } |
| 695 | } |
| 696 | } |
| 697 | this->Storage->CurrentAxis = -1; |
| 698 | this->Scene->SetDirty(true); |
| 699 | return true; |
| 700 | } |
| 701 | else if (mouse.GetButton() == this->Actions.Pan()) |
| 702 | { |
| 703 | // Middle mouse button - move and zoom the axes |
| 704 | // Iterate over the axes, see if we are within 10 pixels of an axis |
| 705 | for (size_t i = 0; i < this->Storage->Axes.size(); ++i) |
| 706 | { |
| 707 | vtkAxis* axis = this->Storage->Axes[i]; |
| 708 | if (axis->GetPoint1()[0] - 10 < mouse.GetScenePos()[0] && |
| 709 | axis->GetPoint1()[0] + 10 > mouse.GetScenePos()[0]) |
| 710 | { |
| 711 | this->Storage->CurrentAxis = static_cast<int>(i); |
| 712 | if (mouse.GetScenePos().GetY() > axis->GetPoint1()[1] && |
| 713 | mouse.GetScenePos().GetY() < axis->GetPoint1()[1] + 20) |
nothing calls this directly
no test coverage detected