-------------------------------------------------------------------------------------------------
| 18 | |
| 19 | //------------------------------------------------------------------------------------------------- |
| 20 | bool QQuickVTKInteractorAdapter::ProcessEvent(QEvent* e, vtkRenderWindowInteractor* iren) |
| 21 | { |
| 22 | if (iren == nullptr || e == nullptr) |
| 23 | return false; |
| 24 | |
| 25 | const QEvent::Type t = e->type(); |
| 26 | |
| 27 | if (t == QQuickVTKPinchEvent::QQuickVTKPinch) |
| 28 | { |
| 29 | QQuickVTKPinchEvent* e2 = static_cast<QQuickVTKPinchEvent*>(e); |
| 30 | if (e2->pinchEventType() != QQuickVTKPinchEvent::QQUICKVTK_NONE) |
| 31 | { |
| 32 | iren->SetEventInformationFlipY(e2->position().x() * this->DevicePixelRatio + |
| 33 | QVTKInteractorAdapter::DevicePixelRatioTolerance, |
| 34 | e2->position().y() * this->DevicePixelRatio + |
| 35 | QVTKInteractorAdapter::DevicePixelRatioTolerance); |
| 36 | } |
| 37 | switch (e2->pinchEventType()) |
| 38 | { |
| 39 | case QQuickVTKPinchEvent::QQUICKVTK_TRANSLATE: |
| 40 | { |
| 41 | double trans[2] = { e2->translation().x() * this->DevicePixelRatio + |
| 42 | QVTKInteractorAdapter::DevicePixelRatioTolerance, |
| 43 | -1.0 * e2->translation().y() * this->DevicePixelRatio + |
| 44 | QVTKInteractorAdapter::DevicePixelRatioTolerance }; |
| 45 | iren->SetTranslation(trans); |
| 46 | iren->InvokeEvent(vtkCommand::StartPanEvent, nullptr); |
| 47 | iren->InvokeEvent(vtkCommand::PanEvent, nullptr); |
| 48 | iren->InvokeEvent(vtkCommand::EndPanEvent, nullptr); |
| 49 | break; |
| 50 | } |
| 51 | case QQuickVTKPinchEvent::QQUICKVTK_SCALE: |
| 52 | { |
| 53 | iren->SetScale(1.0); |
| 54 | iren->SetScale(e2->scale()); |
| 55 | iren->InvokeEvent(vtkCommand::StartPinchEvent, nullptr); |
| 56 | iren->InvokeEvent(vtkCommand::PinchEvent, nullptr); |
| 57 | iren->InvokeEvent(vtkCommand::EndPinchEvent, nullptr); |
| 58 | break; |
| 59 | } |
| 60 | case QQuickVTKPinchEvent::QQUICKVTK_ROTATE: |
| 61 | { |
| 62 | iren->SetRotation(0.0); |
| 63 | iren->SetRotation(-1.0 * e2->angle()); |
| 64 | iren->InvokeEvent(vtkCommand::StartRotateEvent, nullptr); |
| 65 | iren->InvokeEvent(vtkCommand::RotateEvent, nullptr); |
| 66 | iren->InvokeEvent(vtkCommand::EndRotateEvent, nullptr); |
| 67 | break; |
| 68 | } |
| 69 | default: |
| 70 | { |
| 71 | return this->Superclass::ProcessEvent(e, iren); |
| 72 | } |
| 73 | } |
| 74 | e2->accept(); |
| 75 | return true; |
| 76 | } |
| 77 | else |
no test coverage detected