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

Method MouseButtonPressEvent

Charts/Core/vtkChartXY.cxx:2042–2100  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2040
2041//------------------------------------------------------------------------------
2042bool vtkChartXY::MouseButtonPressEvent(const vtkContextMouseEvent& mouse)
2043{
2044 if (this->Tooltip)
2045 {
2046 this->Tooltip->SetVisible(false);
2047 }
2048
2049 // Iterate through each corner, and check for a nearby point
2050 for (size_t i = 0; i < this->ChartPrivate->PlotCorners.size(); ++i)
2051 {
2052 if (this->ChartPrivate->PlotCorners[i]->MouseButtonPressEvent(mouse))
2053 {
2054 return true;
2055 }
2056 }
2057 if (mouse.GetButton() == this->Actions.Pan())
2058 {
2059 // The mouse panning action.
2060 this->MouseBox.Set(mouse.GetPos().GetX(), mouse.GetPos().GetY(), 0.0, 0.0);
2061 this->DrawBox = false;
2062 return true;
2063 }
2064 else if (mouse.GetButton() == this->Actions.Zoom() || mouse.GetButton() == this->Actions.Select())
2065 {
2066 // Selection, for now at least...
2067 this->MouseBox.Set(mouse.GetPos().GetX(), mouse.GetPos().GetY(), 0.0, 0.0);
2068 this->DrawBox = true;
2069 return true;
2070 }
2071 else if (mouse.GetButton() == this->Actions.ZoomAxis())
2072 {
2073 this->MouseBox.Set(mouse.GetPos().GetX(), mouse.GetPos().GetY(), 0.0, 0.0);
2074 this->DrawBox = false;
2075 return true;
2076 }
2077 else if (mouse.GetButton() == this->Actions.SelectPolygon())
2078 {
2079 this->SelectionPolygon.Clear();
2080 this->SelectionPolygon.AddPoint(mouse.GetPos());
2081 this->DrawSelectionPolygon = true;
2082 return true;
2083 }
2084 else if (mouse.GetButton() == this->Actions.ClickAndDrag())
2085 {
2086 this->ReleasePlotSelections();
2087 this->DragPoint = this->LocatePointInPlots(mouse, vtkCommand::SelectionChangedEvent);
2088 this->InvokeEvent(vtkCommand::SelectionChangedEvent);
2089 return true;
2090 }
2091 else if (mouse.GetButton() == this->ActionsClick.Select() ||
2092 mouse.GetButton() == this->ActionsClick.Notify())
2093 {
2094 return true;
2095 }
2096 else
2097 {
2098 return false;
2099 }

Callers 5

TestLinePlotSelection2Function · 0.45
TestZoomAxisFunction · 0.45
TestLinePlotSelectionFunction · 0.45
TestHistogram2DFunction · 0.45

Calls 12

ReleasePlotSelectionsMethod · 0.95
LocatePointInPlotsMethod · 0.95
InvokeEventMethod · 0.80
NotifyMethod · 0.80
sizeMethod · 0.45
PanMethod · 0.45
SetMethod · 0.45
GetXMethod · 0.45
ZoomMethod · 0.45
SelectMethod · 0.45
ClearMethod · 0.45
AddPointMethod · 0.45

Tested by 5

TestLinePlotSelection2Function · 0.36
TestZoomAxisFunction · 0.36
TestLinePlotSelectionFunction · 0.36
TestHistogram2DFunction · 0.36