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

Method MouseButtonReleaseEvent

Charts/Core/vtkScatterPlotMatrix.cxx:1162–1234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160}
1161
1162bool vtkScatterPlotMatrix::MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse)
1163{
1164 // Check we are not currently already animating
1165 if (this->Private->TimerCallbackInitialized)
1166 {
1167 return true;
1168 }
1169
1170 // Work out which scatter plot was clicked - make that one the active plot.
1171 vtkVector2i pos = this->GetChartIndex(mouse.GetPos());
1172
1173 if (pos.GetX() == -1 || pos.GetX() + pos.GetY() + 1 >= this->Size.GetX())
1174 {
1175 // We didn't click a chart in the bottom-left triangle of the matrix.
1176 return true;
1177 }
1178
1179 // If the left button was used, hyperjump, if the right was used full path.
1180 if (mouse.GetButton() == vtkContextMouseEvent::LEFT_BUTTON)
1181 {
1182 if (this->NumberOfFrames == 0)
1183 {
1184 this->SetActivePlot(pos);
1185 return true;
1186 }
1187 this->Private->AnimationPath.clear();
1188 bool horizontalFirst = pos[0] <= this->ActivePlot[0];
1189 if (horizontalFirst)
1190 {
1191 if (pos[0] != this->ActivePlot[0])
1192 {
1193 this->Private->AnimationPath.emplace_back(pos[0], this->ActivePlot[1]);
1194 }
1195 }
1196 else
1197 {
1198 if (pos[1] != this->ActivePlot[1])
1199 {
1200 this->Private->AnimationPath.emplace_back(this->ActivePlot[0], pos[1]);
1201 }
1202 }
1203 if ((this->Private->AnimationPath.size() == 1 && this->Private->AnimationPath.back() != pos) ||
1204 (this->Private->AnimationPath.empty() && this->ActivePlot != pos))
1205 {
1206 this->Private->AnimationPath.push_back(pos);
1207 }
1208 if (!this->Private->AnimationPath.empty())
1209 {
1210 this->InvokeEvent(vtkCommand::CreateTimerEvent);
1211 this->StartAnimation(mouse.GetInteractor());
1212 }
1213 }
1214 else if (mouse.GetButton() == vtkContextMouseEvent::RIGHT_BUTTON)
1215 {
1216 if (this->NumberOfFrames == 0)
1217 {
1218 this->SetActivePlot(pos);
1219 return true;

Callers

nothing calls this directly

Calls 13

SetActivePlotMethod · 0.95
StartAnimationMethod · 0.95
UpdateAnimationPathMethod · 0.95
GetChartIndexMethod · 0.80
backMethod · 0.80
InvokeEventMethod · 0.80
GetXMethod · 0.45
clearMethod · 0.45
emplace_backMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected