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

Method OnMouseMove

Interaction/Style/vtkInteractorStyleDrawPolygon.cxx:90–115  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

88
89//------------------------------------------------------------------------------
90void vtkInteractorStyleDrawPolygon::OnMouseMove()
91{
92 if (!this->Interactor || !this->Moving)
93 {
94 return;
95 }
96
97 this->EndPosition[0] = this->Interactor->GetEventPosition()[0];
98 this->EndPosition[1] = this->Interactor->GetEventPosition()[1];
99 const int* size = this->Interactor->GetRenderWindow()->GetSize();
100 this->EndPosition[0] = std::min(this->EndPosition[0], size[0] - 1);
101 this->EndPosition[0] = std::max(this->EndPosition[0], 0);
102 this->EndPosition[1] = std::min(this->EndPosition[1], size[1] - 1);
103 this->EndPosition[1] = std::max(this->EndPosition[1], 0);
104
105 vtkVector2i lastPoint = this->Internal->GetPoint(this->Internal->GetNumberOfPoints() - 1);
106 vtkVector2i newPoint(this->EndPosition[0], this->EndPosition[1]);
107 if ((lastPoint - newPoint).SquaredNorm() > 100)
108 {
109 this->Internal->AddPoint(newPoint);
110 if (this->DrawPolygonPixels)
111 {
112 this->DrawPolygon();
113 }
114 }
115}
116
117//------------------------------------------------------------------------------
118void vtkInteractorStyleDrawPolygon::OnLeftButtonDown()

Callers

nothing calls this directly

Calls 8

DrawPolygonMethod · 0.95
minFunction · 0.50
maxFunction · 0.50
GetSizeMethod · 0.45
GetRenderWindowMethod · 0.45
GetPointMethod · 0.45
GetNumberOfPointsMethod · 0.45
AddPointMethod · 0.45

Tested by

no test coverage detected