Skip to content

Commit 90effff

Browse files
authored
Revert "Add trackpad gesture PointerData types (flutter#28571)" (flutter#31375)
This reverts commit 2062e57.
1 parent 3e7515a commit 90effff

File tree

13 files changed

+6
-356
lines changed

13 files changed

+6
-356
lines changed

lib/ui/platform_dispatcher.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class PlatformDispatcher {
341341
// * pointer_data.cc
342342
// * pointer.dart
343343
// * AndroidTouchProcessor.java
344-
static const int _kPointerDataFieldCount = 35;
344+
static const int _kPointerDataFieldCount = 29;
345345

346346
static PointerDataPacket _unpackPointerDataPacket(ByteData packet) {
347347
const int kStride = Int64List.bytesPerElement;
@@ -381,12 +381,6 @@ class PlatformDispatcher {
381381
platformData: packet.getInt64(kStride * offset++, _kFakeHostEndian),
382382
scrollDeltaX: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
383383
scrollDeltaY: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
384-
panX: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
385-
panY: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
386-
panDeltaX: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
387-
panDeltaY: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
388-
scale: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
389-
rotation: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
390384
));
391385
assert(offset == (i + 1) * _kPointerDataFieldCount);
392386
}

lib/ui/pointer.dart

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ enum PointerChange {
3636

3737
/// The pointer has stopped making contact with the device.
3838
up,
39-
40-
/// A pan/zoom has started on this pointer.
41-
panZoomStart,
42-
43-
/// The pan/zoom on this pointer has updated.
44-
panZoomUpdate,
45-
46-
/// The pan/zoom on this pointer has ended.
47-
panZoomEnd,
4839
}
4940

5041
/// The kind of pointer device.
@@ -61,9 +52,6 @@ enum PointerDeviceKind {
6152
/// A pointer device with a stylus that has been inverted.
6253
invertedStylus,
6354

64-
/// A touch-based pointer device with an indirect surface.
65-
trackpad,
66-
6755
/// An unknown pointer device.
6856
unknown
6957
}
@@ -113,12 +101,6 @@ class PointerData {
113101
this.platformData = 0,
114102
this.scrollDeltaX = 0.0,
115103
this.scrollDeltaY = 0.0,
116-
this.panX = 0.0,
117-
this.panY = 0.0,
118-
this.panDeltaX = 0.0,
119-
this.panDeltaY = 0.0,
120-
this.scale = 0.0,
121-
this.rotation = 0.0,
122104
});
123105

124106
/// Unique identifier that ties the [PointerEvent] to embedder event created it.
@@ -283,40 +265,6 @@ class PointerData {
283265
/// The amount to scroll in the y direction, in physical pixels.
284266
final double scrollDeltaY;
285267

286-
/// For events with change of PointerChange.panZoomUpdate:
287-
///
288-
/// The current panning magnitude of the pan/zoom in the x direction, in
289-
/// physical pixels.
290-
final double panX;
291-
292-
/// For events with change of PointerChange.panZoomUpdate:
293-
///
294-
/// The current panning magnitude of the pan/zoom in the y direction, in
295-
/// physical pixels.
296-
final double panY;
297-
298-
/// For events with change of PointerChange.panZoomUpdate:
299-
///
300-
/// The difference in panning of the pan/zoom in the x direction since the
301-
/// latest panZoomUpdate event, in physical pixels.
302-
final double panDeltaX;
303-
304-
/// For events with change of PointerChange.panZoomUpdate:
305-
///
306-
/// The difference in panning of the pan/zoom in the y direction since the
307-
/// last panZoomUpdate event, in physical pixels.
308-
final double panDeltaY;
309-
310-
/// For events with change of PointerChange.panZoomUpdate:
311-
///
312-
/// The current scale of the pan/zoom (unitless), with 1.0 as the initial scale.
313-
final double scale;
314-
315-
/// For events with change of PointerChange.panZoomUpdate:
316-
///
317-
/// The current angle of the pan/zoom in radians, with 0.0 as the initial angle.
318-
final double rotation;
319-
320268
@override
321269
String toString() => 'PointerData(x: $physicalX, y: $physicalY)';
322270

@@ -350,13 +298,7 @@ class PointerData {
350298
'tilt: $tilt, '
351299
'platformData: $platformData, '
352300
'scrollDeltaX: $scrollDeltaX, '
353-
'scrollDeltaY: $scrollDeltaY, '
354-
'panX: $panX, '
355-
'panY: $panY, '
356-
'panDeltaX: $panDeltaX, '
357-
'panDeltaY: $panDeltaY, '
358-
'scale: $scale, '
359-
'rotation: $rotation'
301+
'scrollDeltaY: $scrollDeltaY'
360302
')';
361303
}
362304
}

lib/ui/window/pointer_data.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace flutter {
1111

1212
// If this value changes, update the pointer data unpacking code in hooks.dart.
13-
static constexpr int kPointerDataFieldCount = 35;
13+
static constexpr int kPointerDataFieldCount = 29;
1414
static constexpr int kBytesPerField = sizeof(int64_t);
1515
// Must match the button constants in events.dart.
1616
enum PointerButtonMouse : int64_t {
@@ -42,9 +42,6 @@ struct alignas(8) PointerData {
4242
kDown,
4343
kMove,
4444
kUp,
45-
kPanZoomStart,
46-
kPanZoomUpdate,
47-
kPanZoomEnd,
4845
};
4946

5047
// Must match the PointerDeviceKind enum in pointer.dart.
@@ -53,7 +50,6 @@ struct alignas(8) PointerData {
5350
kMouse,
5451
kStylus,
5552
kInvertedStylus,
56-
kTrackpad,
5753
};
5854

5955
// Must match the PointerSignalKind enum in pointer.dart.
@@ -91,12 +87,6 @@ struct alignas(8) PointerData {
9187
int64_t platformData;
9288
double scroll_delta_x;
9389
double scroll_delta_y;
94-
double pan_x;
95-
double pan_y;
96-
double pan_delta_x;
97-
double pan_delta_y;
98-
double scale;
99-
double rotation;
10090

10191
void Clear();
10292
};

lib/ui/window/pointer_data_packet_converter.cc

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include "flutter/lib/ui/window/pointer_data_packet_converter.h"
66

7-
#include <cmath>
87
#include <cstring>
98

109
#include "flutter/fml/logging.h"
@@ -208,88 +207,6 @@ void PointerDataPacketConverter::ConvertPointerData(
208207
converted_pointers.push_back(pointer_data);
209208
break;
210209
}
211-
case PointerData::Change::kPanZoomStart: {
212-
// Makes sure we have an existing pointer
213-
auto iter = states_.find(pointer_data.device);
214-
PointerState state;
215-
if (iter == states_.end()) {
216-
// Synthesizes add event if the pointer is not previously added.
217-
PointerData synthesized_add_event = pointer_data;
218-
synthesized_add_event.change = PointerData::Change::kAdd;
219-
synthesized_add_event.synthesized = 1;
220-
synthesized_add_event.buttons = 0;
221-
state = EnsurePointerState(synthesized_add_event);
222-
converted_pointers.push_back(synthesized_add_event);
223-
} else {
224-
state = iter->second;
225-
}
226-
FML_DCHECK(!state.is_down);
227-
FML_DCHECK(!state.is_pan_zoom_active);
228-
if (LocationNeedsUpdate(pointer_data, state)) {
229-
// Synthesizes a hover event if the location does not match.
230-
PointerData synthesized_hover_event = pointer_data;
231-
synthesized_hover_event.change = PointerData::Change::kHover;
232-
synthesized_hover_event.synthesized = 1;
233-
synthesized_hover_event.buttons = 0;
234-
235-
UpdateDeltaAndState(synthesized_hover_event, state);
236-
converted_pointers.push_back(synthesized_hover_event);
237-
}
238-
239-
UpdatePointerIdentifier(pointer_data, state, true);
240-
state.is_pan_zoom_active = true;
241-
state.pan_x = 0;
242-
state.pan_y = 0;
243-
state.scale = 1;
244-
state.rotation = 0;
245-
states_[pointer_data.device] = state;
246-
converted_pointers.push_back(pointer_data);
247-
break;
248-
}
249-
case PointerData::Change::kPanZoomUpdate: {
250-
// Makes sure we have an existing pointer in pan_zoom_active state
251-
auto iter = states_.find(pointer_data.device);
252-
FML_DCHECK(iter != states_.end());
253-
PointerState state = iter->second;
254-
FML_DCHECK(!state.is_down);
255-
FML_DCHECK(state.is_pan_zoom_active);
256-
257-
UpdatePointerIdentifier(pointer_data, state, false);
258-
UpdateDeltaAndState(pointer_data, state);
259-
260-
converted_pointers.push_back(pointer_data);
261-
break;
262-
}
263-
case PointerData::Change::kPanZoomEnd: {
264-
// Makes sure we have an existing pointer in pan_zoom_active state
265-
auto iter = states_.find(pointer_data.device);
266-
FML_DCHECK(iter != states_.end());
267-
PointerState state = iter->second;
268-
FML_DCHECK(state.is_pan_zoom_active);
269-
270-
UpdatePointerIdentifier(pointer_data, state, false);
271-
272-
if (LocationNeedsUpdate(pointer_data, state)) {
273-
// Synthesizes an update event if the location does not match.
274-
PointerData synthesized_move_event = pointer_data;
275-
synthesized_move_event.change = PointerData::Change::kPanZoomUpdate;
276-
synthesized_move_event.pan_x = state.pan_x;
277-
synthesized_move_event.pan_y = state.pan_y;
278-
synthesized_move_event.pan_delta_x = 0;
279-
synthesized_move_event.pan_delta_y = 0;
280-
synthesized_move_event.scale = state.scale;
281-
synthesized_move_event.rotation = state.rotation;
282-
synthesized_move_event.synthesized = 1;
283-
284-
UpdateDeltaAndState(synthesized_move_event, state);
285-
converted_pointers.push_back(synthesized_move_event);
286-
}
287-
288-
state.is_pan_zoom_active = false;
289-
states_[pointer_data.device] = state;
290-
converted_pointers.push_back(pointer_data);
291-
break;
292-
}
293210
default: {
294211
converted_pointers.push_back(pointer_data);
295212
break;
@@ -344,11 +261,8 @@ PointerState PointerDataPacketConverter::EnsurePointerState(
344261
PointerState state;
345262
state.pointer_identifier = 0;
346263
state.is_down = false;
347-
state.is_pan_zoom_active = false;
348264
state.physical_x = pointer_data.physical_x;
349265
state.physical_y = pointer_data.physical_y;
350-
state.pan_x = 0;
351-
state.pan_y = 0;
352266
states_[pointer_data.device] = state;
353267
return state;
354268
}
@@ -357,14 +271,8 @@ void PointerDataPacketConverter::UpdateDeltaAndState(PointerData& pointer_data,
357271
PointerState& state) {
358272
pointer_data.physical_delta_x = pointer_data.physical_x - state.physical_x;
359273
pointer_data.physical_delta_y = pointer_data.physical_y - state.physical_y;
360-
pointer_data.pan_delta_x = pointer_data.pan_x - state.pan_x;
361-
pointer_data.pan_delta_y = pointer_data.pan_y - state.pan_y;
362274
state.physical_x = pointer_data.physical_x;
363275
state.physical_y = pointer_data.physical_y;
364-
state.pan_x = pointer_data.pan_x;
365-
state.pan_y = pointer_data.pan_y;
366-
state.scale = pointer_data.scale;
367-
state.rotation = pointer_data.rotation;
368276
states_[pointer_data.device] = state;
369277
}
370278

lib/ui/window/pointer_data_packet_converter.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,8 @@ namespace flutter {
3030
struct PointerState {
3131
int64_t pointer_identifier;
3232
bool is_down;
33-
bool is_pan_zoom_active;
3433
double physical_x;
3534
double physical_y;
36-
double pan_x;
37-
double pan_y;
38-
double scale;
39-
double rotation;
4035
int64_t buttons;
4136
};
4237

0 commit comments

Comments
 (0)