------------------------------------------------------------------------------
| 88 | |
| 89 | //------------------------------------------------------------------------------ |
| 90 | void 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 | //------------------------------------------------------------------------------ |
| 118 | void vtkInteractorStyleDrawPolygon::OnLeftButtonDown() |
nothing calls this directly
no test coverage detected