------------------------------------------------------------------------------
| 738 | |
| 739 | //------------------------------------------------------------------------------ |
| 740 | bool vtkChartParallelCoordinates::MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) |
| 741 | { |
| 742 | if (mouse.GetButton() == this->Actions.Select()) |
| 743 | { |
| 744 | if (this->Storage->CurrentAxis < 0) |
| 745 | { |
| 746 | this->ClearAllAxesSelections(); |
| 747 | this->Storage->Plot->ResetSelectionRange(); |
| 748 | } |
| 749 | else |
| 750 | { |
| 751 | std::array<float, 2>& range = this->Storage->CurrentSelection; |
| 752 | |
| 753 | float final = mouse.GetScenePos()[1]; |
| 754 | final -= this->Storage->Transform->GetMatrix()->GetElement(1, 2); |
| 755 | final /= this->Storage->Transform->GetMatrix()->GetElement(1, 1); |
| 756 | |
| 757 | // Set the final mouse position |
| 758 | if (final > 1.0) |
| 759 | { |
| 760 | range[1] = 1.0; |
| 761 | } |
| 762 | else if (final < 0.0) |
| 763 | { |
| 764 | range[1] = 0.0; |
| 765 | } |
| 766 | else |
| 767 | { |
| 768 | range[1] = final; |
| 769 | } |
| 770 | |
| 771 | // Update all range stored based on the new selection |
| 772 | this->UpdateCurrentAxisSelection(this->Storage->CurrentAxis); |
| 773 | |
| 774 | // To support multiple selection, we need to recalculate all the selection |
| 775 | this->ResetSelection(); |
| 776 | |
| 777 | this->Storage->CurrentSelection[0] = 0; |
| 778 | this->Storage->CurrentSelection[1] = 0; |
| 779 | |
| 780 | // This is a manual interactive selection |
| 781 | this->Storage->InteractiveSelection = true; |
| 782 | this->Storage->ShouldClearCurrentAxeSelection = true; |
| 783 | |
| 784 | if (this->AnnotationLink) |
| 785 | { |
| 786 | vtkSelection* selection = vtkSelection::New(); |
| 787 | vtkSelectionNode* node = vtkSelectionNode::New(); |
| 788 | selection->AddNode(node); |
| 789 | node->SetContentType(vtkSelectionNode::INDICES); |
| 790 | node->SetFieldType(vtkSelectionNode::POINT); |
| 791 | |
| 792 | node->SetSelectionList(this->Storage->Plot->GetSelection()); |
| 793 | this->AnnotationLink->SetCurrentSelection(selection); |
| 794 | selection->Delete(); |
| 795 | node->Delete(); |
| 796 | } |
| 797 | } |
nothing calls this directly
no test coverage detected