------------------------------------------------------------------------------
| 96 | |
| 97 | //------------------------------------------------------------------------------ |
| 98 | int vtkVRPanelRepresentation::ComputeComplexInteractionState( |
| 99 | vtkRenderWindowInteractor*, vtkAbstractWidget*, unsigned long, void* calldata, int) |
| 100 | { |
| 101 | if (!this->AllowAdjustment || this->InteractionState == vtkVRPanelRepresentation::Moving) |
| 102 | { |
| 103 | return this->InteractionState; |
| 104 | } |
| 105 | |
| 106 | vtkEventData* edata = static_cast<vtkEventData*>(calldata); |
| 107 | vtkEventDataDevice3D* edd = edata->GetAsEventDataDevice3D(); |
| 108 | if (edd) |
| 109 | { |
| 110 | double pos[4]; |
| 111 | edd->GetWorldPosition(pos); |
| 112 | pos[3] = 1.0; |
| 113 | |
| 114 | const double* bds = this->TextActor->GetBounds(); |
| 115 | double length = sqrt((bds[1] - bds[0]) * (bds[1] - bds[0]) + |
| 116 | (bds[3] - bds[2]) * (bds[3] - bds[2]) + (bds[5] - bds[4]) * (bds[5] - bds[4])); |
| 117 | double tolerance = length * 0.05; |
| 118 | if (pos[0] > bds[0] - tolerance && pos[0] < bds[1] + tolerance && pos[1] > bds[2] - tolerance && |
| 119 | pos[1] < bds[3] + tolerance && pos[2] > bds[4] - tolerance && pos[2] < bds[5] + tolerance) |
| 120 | { |
| 121 | this->InteractionState = vtkVRPanelRepresentation::Moving; |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | this->InteractionState = vtkVRPanelRepresentation::Outside; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | return this->InteractionState; |
| 130 | } |
| 131 | |
| 132 | //------------------------------------------------------------------------------ |
| 133 | void vtkVRPanelRepresentation::StartComplexInteraction( |
no test coverage detected