| Flutter Windows Embedder |

Classes | Public Member Functions | Friends | List of all members
flutter::DirectManipulationEventHandler Class Reference

`#include <direct_manipulation.h>`

Inheritance diagram for flutter::DirectManipulationEventHandler:

## Public Member Functions
| DirectManipulationEventHandler (DirectManipulationOwner *owner)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv) override
ULONG STDMETHODCALLTYPE | AddRef () override
ULONG STDMETHODCALLTYPE | Release () override
HRESULT STDMETHODCALLTYPE | OnViewportStatusChanged (IDirectManipulationViewport *viewport, DIRECTMANIPULATION_STATUS current, DIRECTMANIPULATION_STATUS previous) override
HRESULT STDMETHODCALLTYPE | OnViewportUpdated (IDirectManipulationViewport *viewport) override
HRESULT STDMETHODCALLTYPE | OnContentUpdated (IDirectManipulationViewport *viewport, IDirectManipulationContent *content) override
HRESULT STDMETHODCALLTYPE | OnInteraction (IDirectManipulationViewport2 *viewport, DIRECTMANIPULATION_INTERACTION_TYPE interaction) override

## Friends
class | DirectManipulationOwner

## Detailed Description

Definition at line 67 of file direct_manipulation.h.

## Constructor & Destructor Documentation

## ◆ DirectManipulationEventHandler()

flutter::DirectManipulationEventHandler::DirectManipulationEventHandler | ( | DirectManipulationOwner * | owner | ) |
| inline explicit

Definition at line 76 of file direct_manipulation.h.

77 : owner_(owner) {}

## Member Function Documentation

## ◆ AddRef()

ULONG STDMETHODCALLTYPE flutter::DirectManipulationEventHandler::AddRef | ( |  | ) |
| override

Definition at line 165 of file direct_manipulation.cc.

165 {
166 RefCountedThreadSafe::AddRef();
167 return 0;
168 }

Referenced by QueryInterface().

## ◆ OnContentUpdated()

HRESULT flutter::DirectManipulationEventHandler::OnContentUpdated | ( | IDirectManipulationViewport * | viewport,
|  | IDirectManipulationContent * | content
| ) |  |
| override

Definition at line 133 of file direct_manipulation.cc.

135 {
136 float transform[6];
137 HRESULT hr = content->GetContentTransform(transform, ARRAYSIZE(transform));
138 if (FAILED(hr)) {
139 FML_LOG(ERROR) << "GetContentTransform failed";
140 return S_OK;
141 }
142 if (!during_synthesized_reset_) {
143 GestureData data = ConvertToGestureData(transform);
144 float scale = data.scale / initial_gesture_data_.scale;
145 float pan_x = data.pan_x - initial_gesture_data_.pan_x;
146 float pan_y = data.pan_y - initial_gesture_data_.pan_y;
147 last_pan_delta_x_ = pan_x - last_pan_x_;
148 last_pan_delta_y_ = pan_y - last_pan_y_;
149 last_pan_x_ = pan_x;
150 last_pan_y_ = pan_y;
151 if (owner_->binding_handler_delegate && !during_inertia_) {
152 owner_->binding_handler_delegate->OnPointerPanZoomUpdate(
153 GetDeviceId(), pan_x, pan_y, scale, 0);
154 }
155 }
156 return S_OK;
157 }

References flutter::DirectManipulationOwner::binding_handler_delegate, content, and flutter::WindowBindingHandlerDelegate::OnPointerPanZoomUpdate().

## ◆ OnInteraction()

HRESULT flutter::DirectManipulationEventHandler::OnInteraction | ( | IDirectManipulationViewport2 * | viewport,
|  | DIRECTMANIPULATION_INTERACTION_TYPE | interaction
| ) |  |
| override

Definition at line 159 of file direct_manipulation.cc.

161 {
162 return S_OK;
163 }

## ◆ OnViewportStatusChanged()

HRESULT flutter::DirectManipulationEventHandler::OnViewportStatusChanged | ( | IDirectManipulationViewport * | viewport,
|  | DIRECTMANIPULATION_STATUS | current,
|  | DIRECTMANIPULATION_STATUS | previous
| ) |  |
| override

Definition at line 64 of file direct_manipulation.cc.

67 {
68 if (during_synthesized_reset_) {
69 during_synthesized_reset_ = current != DIRECTMANIPULATION_READY;
70 return S_OK;
71 }
72 during_inertia_ = current == DIRECTMANIPULATION_INERTIA;
73 if (current == DIRECTMANIPULATION_RUNNING) {
74 IDirectManipulationContent* content;
75 HRESULT hr = viewport->GetPrimaryContent(IID_PPV_ARGS(&content));
76 if (SUCCEEDED(hr)) {
77 float transform[6];
78 hr = content->GetContentTransform(transform, ARRAYSIZE(transform));
79 if (SUCCEEDED(hr)) {
80 initial_gesture_data_ = ConvertToGestureData(transform);
81 } else {
82 FML_LOG(ERROR) << "GetContentTransform failed";
83 }
84 } else {
85 FML_LOG(ERROR) << "GetPrimaryContent failed";
86 }
87 if (owner_->binding_handler_delegate) {
88 owner_->binding_handler_delegate->OnPointerPanZoomStart(GetDeviceId());
89 }
90 } else if (previous == DIRECTMANIPULATION_RUNNING) {
91 // Reset deltas to ensure only inertia values will be compared later.
92 last_pan_delta_x_ = 0.0;
93 last_pan_delta_y_ = 0.0;
94 if (owner_->binding_handler_delegate) {
95 owner_->binding_handler_delegate->OnPointerPanZoomEnd(GetDeviceId());
96 }
97 } else if (previous == DIRECTMANIPULATION_INERTIA) {
98 if (owner_->binding_handler_delegate &&
99 (std::max)(std::abs(last_pan_delta_x_), std::abs(last_pan_delta_y_)) >
100 0.01) {
101 owner_->binding_handler_delegate->OnScrollInertiaCancel(GetDeviceId());
102 }
103 // Need to reset the content transform to its original position
104 // so that we are ready for the next gesture.
105 // Use during_synthesized_reset_ flag to prevent sending reset also to the
106 // framework.
107 during_synthesized_reset_ = true;
108 last_pan_x_ = 0.0;
109 last_pan_y_ = 0.0;
110 last_pan_delta_x_ = 0.0;
111 last_pan_delta_y_ = 0.0;
112 RECT rect;
113 HRESULT hr = viewport->GetViewportRect(&rect);
114 if (FAILED(hr)) {
115 FML_LOG(ERROR) << "Failed to get the current viewport rect";
116 return E_FAIL;
117 }
118 hr = viewport->ZoomToRect(rect.left, rect.top, rect.right, rect.bottom,
119 false);
120 if (FAILED(hr)) {
121 FML_LOG(ERROR) << "Failed to reset the gesture using ZoomToRect";
122 return E_FAIL;
123 }
124 }
125 return S_OK;
126 }

References flutter::DirectManipulationOwner::binding_handler_delegate, content, flutter::WindowBindingHandlerDelegate::OnPointerPanZoomEnd(), flutter::WindowBindingHandlerDelegate::OnPointerPanZoomStart(), and flutter::WindowBindingHandlerDelegate::OnScrollInertiaCancel().

## ◆ OnViewportUpdated()

HRESULT flutter::DirectManipulationEventHandler::OnViewportUpdated | ( | IDirectManipulationViewport * | viewport | ) |
| override

Definition at line 128 of file direct_manipulation.cc.

129 {
130 return S_OK;
131 }

## ◆ QueryInterface()

STDMETHODIMP flutter::DirectManipulationEventHandler::QueryInterface | ( | REFIID | iid,
|  | void ** | ppv
| ) |  |
| override

Definition at line 33 of file direct_manipulation.cc.

34 {
35 if ((iid == IID_IUnknown) ||
36 (iid == IID_IDirectManipulationViewportEventHandler)) {
37 *ppv = static_cast<IDirectManipulationViewportEventHandler*>(this);
38 AddRef();
39 return S_OK;
40 } else if (iid == IID_IDirectManipulationInteractionEventHandler) {
41 *ppv = static_cast<IDirectManipulationInteractionEventHandler*>(this);
42 AddRef();
43 return S_OK;
44 }
45 return E_NOINTERFACE;
46 }

References AddRef().

## ◆ Release()

ULONG STDMETHODCALLTYPE flutter::DirectManipulationEventHandler::Release | ( |  | ) |
| override

Definition at line 170 of file direct_manipulation.cc.

170 {
171 RefCountedThreadSafe::Release();
172 return 0;
173 }

## Friends And Related Function Documentation

## ◆ DirectManipulationOwner

friend class DirectManipulationOwner
| friend

Definition at line 71 of file direct_manipulation.h.

The documentation for this class was generated from the following files:

- shell/platform/windows/direct_manipulation.h
- shell/platform/windows/direct_manipulation.cc

content
union flutter::testing::@88::KeyboardChange::@0 content
flutter::WindowBindingHandlerDelegate::OnPointerPanZoomEnd
virtual void OnPointerPanZoomEnd(int32_t device_id)=0
flutter::WindowBindingHandlerDelegate::OnPointerPanZoomUpdate
virtual void OnPointerPanZoomUpdate(int32_t device_id, double pan_x, double pan_y, double scale, double rotation)=0
flutter::WindowBindingHandlerDelegate::OnScrollInertiaCancel
virtual void OnScrollInertiaCancel(int32_t device_id)=0
flutter::DirectManipulationOwner::binding_handler_delegate
WindowBindingHandlerDelegate * binding_handler_delegate
Definition: direct_manipulation.h:46
flutter::DirectManipulationEventHandler::AddRef
ULONG STDMETHODCALLTYPE AddRef() override
Definition: direct_manipulation.cc:165
flutter::WindowBindingHandlerDelegate::OnPointerPanZoomStart
virtual void OnPointerPanZoomStart(int32_t device_id)=0