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

Method OnMouseMove

Interaction/Widgets/vtkLineWidget.cxx:824–876  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

822
823//------------------------------------------------------------------------------
824void vtkLineWidget::OnMouseMove()
825{
826 // See whether we're active
827 if (this->State == vtkLineWidget::Outside || this->State == vtkLineWidget::Start)
828 {
829 return;
830 }
831
832 int X = this->Interactor->GetEventPosition()[0];
833 int Y = this->Interactor->GetEventPosition()[1];
834
835 // Do different things depending on state
836 // Calculations everybody does
837 double focalPoint[4], pickPoint[4], prevPickPoint[4];
838 double z;
839
840 vtkCamera* camera = this->CurrentRenderer->GetActiveCamera();
841 if (!camera)
842 {
843 return;
844 }
845
846 // Compute the two points defining the motion vector
847 this->ComputeWorldToDisplay(
848 this->LastPickPosition[0], this->LastPickPosition[1], this->LastPickPosition[2], focalPoint);
849 z = focalPoint[2];
850 this->ComputeDisplayToWorld(double(this->Interactor->GetLastEventPosition()[0]),
851 double(this->Interactor->GetLastEventPosition()[1]), z, prevPickPoint);
852 this->ComputeDisplayToWorld(double(X), double(Y), z, pickPoint);
853
854 // Process the motion
855 int forward = 0;
856 if (this->State == vtkLineWidget::MovingHandle)
857 {
858 forward = this->ForwardEvent(vtkCommand::MouseMoveEvent);
859 }
860 else if (this->State == vtkLineWidget::MovingLine)
861 {
862 forward = this->ForwardEvent(vtkCommand::MouseMoveEvent);
863 }
864 else if (this->State == vtkLineWidget::Scaling)
865 {
866 this->Scale(prevPickPoint, pickPoint, X, Y);
867 }
868
869 // Interact, if desired
870 this->EventCallbackCommand->SetAbortFlag(1);
871 this->InvokeEvent(vtkCommand::InteractionEvent, nullptr);
872 if (!forward)
873 {
874 this->Interactor->Render();
875 }
876}
877
878//------------------------------------------------------------------------------
879void vtkLineWidget::Scale(double* p1, double* p2, int vtkNotUsed(X), int Y)

Callers 1

ProcessEventsMethod · 0.95

Calls 7

ForwardEventMethod · 0.95
ScaleMethod · 0.95
GetActiveCameraMethod · 0.80
ComputeWorldToDisplayMethod · 0.80
ComputeDisplayToWorldMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65

Tested by

no test coverage detected