提交 1a40ee95 编写于 作者: A Adam Barth 提交者: GitHub

PointerChange.cancel should have a zero index (#3135)

To make the default state all zeros.

Fixes https://github.com/flutter/flutter/issues/6236
上级 77ce805c
......@@ -6,6 +6,9 @@ part of dart_ui;
/// How the pointer has changed since the last report.
enum PointerChange {
/// The input from the pointer is no longer directed towards this receiver.
cancel,
/// The device has started tracking the pointer.
///
/// For example, the pointer might be hovering above the device, having not yet
......@@ -26,9 +29,6 @@ enum PointerChange {
/// The pointer has stopped making contact with the device.
up,
/// The input from the pointer is no longer directed towards this receiver.
cancel,
}
/// The kind of pointer device.
......
......@@ -4,6 +4,8 @@
#include "flutter/lib/ui/window/pointer_data.h"
#include <string.h>
namespace blink {
// If this value changes, update the pointer data unpacking code in hooks.dart.
......@@ -13,25 +15,7 @@ static_assert(sizeof(PointerData) == sizeof(int64_t) * kPointerDataFieldCount,
"PointerData has the wrong size");
void PointerData::Clear() {
time_stamp = 0;
pointer = 0;
change = Change::kCancel;
kind = DeviceKind::kTouch;
physical_x = 0.0;
physical_y = 0.0;
buttons = 0;
obscured = 0;
pressure = 0.0;
pressure_min = 0.0;
pressure_max = 0.0;
distance = 0.0;
distance_max = 0.0;
radius_major = 0.0;
radius_minor = 0.0;
radius_min = 0.0;
radius_max = 0.0;
orientation = 0.0;
tilt = 0.0;
memset(this, 0, sizeof(PointerData));
}
} // namespace blink
......@@ -13,12 +13,12 @@ namespace blink {
struct alignas(8) PointerData {
// Must match the PointerChange enum in pointer.dart.
enum class Change : int64_t {
kCancel,
kAdd,
kRemove,
kDown,
kMove,
kUp,
kCancel,
};
// Must match the PointerDeviceKind enum in pointer.dart.
......
......@@ -261,12 +261,12 @@ public class FlutterView extends SurfaceView
}
// Must match the PointerChange enum in pointer.dart.
private static final int kPointerChangeAdd = 0;
private static final int kPointerChangeRemove = 1;
private static final int kPointerChangeDown = 2;
private static final int kPointerChangeMove = 3;
private static final int kPointerChangeUp = 4;
private static final int kPointerChangeCancel = 5;
private static final int kPointerChangeCancel = 0;
private static final int kPointerChangeAdd = 1;
private static final int kPointerChangeRemove = 2;
private static final int kPointerChangeDown = 3;
private static final int kPointerChangeMove = 4;
private static final int kPointerChangeUp = 5;
// Must match the PointerDeviceKind enum in pointer.dart.
private static final int kPointerDeviceKindTouch = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册