------------------------------------------------------------------------------
| 2040 | |
| 2041 | //------------------------------------------------------------------------------ |
| 2042 | bool 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 | } |