MCPcopy Create free account
hub / github.com/Kitware/VTK / MouseButtonReleaseEvent

Method MouseButtonReleaseEvent

Charts/Core/vtkChartParallelCoordinates.cxx:740–811  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

738
739//------------------------------------------------------------------------------
740bool 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 }

Callers

nothing calls this directly

Calls 15

ResetSelectionMethod · 0.95
ResetSelectionRangeMethod · 0.80
SetSelectionListMethod · 0.80
InvokeEventMethod · 0.80
SetDirtyMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
SelectMethod · 0.45
GetMatrixMethod · 0.45
AddNodeMethod · 0.45

Tested by

no test coverage detected