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

Method OnMouseMove

Interaction/Widgets/vtkBoxWidget.cxx:756–839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754}
755
756void vtkBoxWidget::OnMouseMove()
757{
758 // See whether we're active
759 if (this->State == vtkBoxWidget::Outside || this->State == vtkBoxWidget::Start)
760 {
761 return;
762 }
763
764 int X = this->Interactor->GetEventPosition()[0];
765 int Y = this->Interactor->GetEventPosition()[1];
766
767 // Do different things depending on state
768 // Calculations everybody does
769 double focalPoint[4], pickPoint[4], prevPickPoint[4];
770 double z, vpn[3];
771
772 vtkCamera* camera = this->CurrentRenderer->GetActiveCamera();
773 if (!camera)
774 {
775 return;
776 }
777
778 // Compute the two points defining the motion vector
779 this->ComputeWorldToDisplay(
780 this->LastPickPosition[0], this->LastPickPosition[1], this->LastPickPosition[2], focalPoint);
781 z = focalPoint[2];
782 this->ComputeDisplayToWorld(double(this->Interactor->GetLastEventPosition()[0]),
783 double(this->Interactor->GetLastEventPosition()[1]), z, prevPickPoint);
784 this->ComputeDisplayToWorld(double(X), double(Y), z, pickPoint);
785
786 // Process the motion
787 if (this->State == vtkBoxWidget::Moving)
788 {
789 // Okay to process
790 if (this->CurrentHandle)
791 {
792 if (this->RotationEnabled && this->CurrentHandle == this->HexFace)
793 {
794 camera->GetViewPlaneNormal(vpn);
795 this->Rotate(X, Y, prevPickPoint, pickPoint, vpn);
796 }
797 else if (this->TranslationEnabled && this->CurrentHandle == this->Handle[6])
798 {
799 this->Translate(prevPickPoint, pickPoint);
800 }
801 else if (this->TranslationEnabled && this->ScalingEnabled)
802 {
803 if (this->CurrentHandle == this->Handle[0])
804 {
805 this->MoveMinusXFace(prevPickPoint, pickPoint);
806 }
807 else if (this->CurrentHandle == this->Handle[1])
808 {
809 this->MovePlusXFace(prevPickPoint, pickPoint);
810 }
811 else if (this->CurrentHandle == this->Handle[2])
812 {
813 this->MoveMinusYFace(prevPickPoint, pickPoint);

Callers 1

ProcessEventsMethod · 0.95

Calls 14

RotateMethod · 0.95
TranslateMethod · 0.95
MoveMinusXFaceMethod · 0.95
MovePlusXFaceMethod · 0.95
MoveMinusYFaceMethod · 0.95
MovePlusYFaceMethod · 0.95
MoveMinusZFaceMethod · 0.95
MovePlusZFaceMethod · 0.95
ScaleMethod · 0.95
GetActiveCameraMethod · 0.80
ComputeWorldToDisplayMethod · 0.80
ComputeDisplayToWorldMethod · 0.80

Tested by

no test coverage detected