Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
b5758d0d
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b5758d0d
编写于
11月 02, 2018
作者:
S
Stanislav Baranov
提交者:
GitHub
11月 02, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Propagate positions of secondary pointers in UP events on Android (#6716)
上级
57c21d4d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
14 deletion
+41
-14
lib/ui/hooks.dart
lib/ui/hooks.dart
+3
-2
lib/ui/pointer.dart
lib/ui/pointer.dart
+7
-2
lib/ui/window/pointer_data.cc
lib/ui/window/pointer_data.cc
+1
-1
lib/ui/window/pointer_data.h
lib/ui/window/pointer_data.h
+1
-0
shell/platform/android/io/flutter/view/FlutterView.java
shell/platform/android/io/flutter/view/FlutterView.java
+29
-9
未找到文件。
lib/ui/hooks.dart
浏览文件 @
b5758d0d
...
...
@@ -196,7 +196,7 @@ void _invoke3<A1, A2, A3>(void callback(A1 a1, A2 a2, A3 a3), Zone zone, A1 arg1
//
// * pointer_data.cc
// * FlutterView.java
const
int
_kPointerDataFieldCount
=
2
0
;
const
int
_kPointerDataFieldCount
=
2
1
;
PointerDataPacket
_unpackPointerDataPacket
(
ByteData
packet
)
{
const
int
kStride
=
Int64List
.
bytesPerElement
;
...
...
@@ -226,7 +226,8 @@ PointerDataPacket _unpackPointerDataPacket(ByteData packet) {
radiusMin:
packet
.
getFloat64
(
kStride
*
offset
++,
_kFakeHostEndian
),
radiusMax:
packet
.
getFloat64
(
kStride
*
offset
++,
_kFakeHostEndian
),
orientation:
packet
.
getFloat64
(
kStride
*
offset
++,
_kFakeHostEndian
),
tilt:
packet
.
getFloat64
(
kStride
*
offset
++,
_kFakeHostEndian
)
tilt:
packet
.
getFloat64
(
kStride
*
offset
++,
_kFakeHostEndian
),
platformData:
packet
.
getInt64
(
kStride
*
offset
++,
_kFakeHostEndian
),
);
assert
(
offset
==
(
i
+
1
)
*
_kPointerDataFieldCount
);
}
...
...
lib/ui/pointer.dart
浏览文件 @
b5758d0d
...
...
@@ -77,7 +77,8 @@ class PointerData {
this
.
radiusMin
:
0.0
,
this
.
radiusMax
:
0.0
,
this
.
orientation
:
0.0
,
this
.
tilt
:
0.0
this
.
tilt
:
0.0
,
this
.
platformData
:
0
,
});
/// Time of event dispatch, relative to an arbitrary timeline.
...
...
@@ -199,6 +200,9 @@ class PointerData {
/// the stylus is flat on that surface).
final
double
tilt
;
/// Opaque platform-specific data associated with the event.
final
int
platformData
;
@override
String
toString
()
=>
'
$runtimeType
(x:
$physicalX
, y:
$physicalY
)'
;
...
...
@@ -223,7 +227,8 @@ class PointerData {
'radiusMin:
$radiusMin
, '
'radiusMax:
$radiusMax
, '
'orientation:
$orientation
, '
'tilt:
$tilt
'
'tilt:
$tilt
, '
'platformData:
$platformData
'
')'
;
}
}
...
...
lib/ui/window/pointer_data.cc
浏览文件 @
b5758d0d
...
...
@@ -9,7 +9,7 @@
namespace
blink
{
// If this value changes, update the pointer data unpacking code in hooks.dart.
static
constexpr
int
kPointerDataFieldCount
=
2
0
;
static
constexpr
int
kPointerDataFieldCount
=
2
1
;
static_assert
(
sizeof
(
PointerData
)
==
sizeof
(
int64_t
)
*
kPointerDataFieldCount
,
"PointerData has the wrong size"
);
...
...
lib/ui/window/pointer_data.h
浏览文件 @
b5758d0d
...
...
@@ -50,6 +50,7 @@ struct alignas(8) PointerData {
double
radius_max
;
double
orientation
;
double
tilt
;
int64_t
platformData
;
void
Clear
();
};
...
...
shell/platform/android/io/flutter/view/FlutterView.java
浏览文件 @
b5758d0d
...
...
@@ -447,8 +447,8 @@ public class FlutterView extends SurfaceView
}
}
private
void
addPointerForIndex
(
MotionEvent
event
,
int
pointerIndex
,
ByteBuffer
packet
)
{
int
pointerChange
=
getPointerChangeForAction
(
event
.
getActionMasked
());
private
void
addPointerForIndex
(
MotionEvent
event
,
int
pointerIndex
,
int
pointerChange
,
int
pointerData
,
ByteBuffer
packet
)
{
if
(
pointerChange
==
-
1
)
{
return
;
}
...
...
@@ -503,6 +503,8 @@ public class FlutterView extends SurfaceView
}
else
{
packet
.
putDouble
(
0.0
);
// tilt
}
packet
.
putLong
(
pointerData
);
// platformData
}
@Override
...
...
@@ -521,26 +523,44 @@ public class FlutterView extends SurfaceView
}
// These values must match the unpacking code in hooks.dart.
final
int
kPointerDataFieldCount
=
2
0
;
final
int
kPointerDataFieldCount
=
2
1
;
final
int
kBytePerField
=
8
;
// This value must match the value in framework's platform_view.dart.
// This flag indicates whether the original Android pointer events were batched together.
final
int
kPointerDataFlagBatched
=
1
;
int
pointerCount
=
event
.
getPointerCount
();
ByteBuffer
packet
=
ByteBuffer
.
allocateDirect
(
pointerCount
*
kPointerDataFieldCount
*
kBytePerField
);
packet
.
order
(
ByteOrder
.
LITTLE_ENDIAN
);
int
maskedAction
=
event
.
getActionMasked
();
// ACTION_UP, ACTION_POINTER_UP, ACTION_DOWN, and ACTION_POINTER_DOWN
// only apply to a single pointer, other events apply to all pointers.
if
(
maskedAction
==
MotionEvent
.
ACTION_UP
||
maskedAction
==
MotionEvent
.
ACTION_POINTER_UP
||
maskedAction
==
MotionEvent
.
ACTION_DOWN
||
maskedAction
==
MotionEvent
.
ACTION_POINTER_DOWN
)
{
addPointerForIndex
(
event
,
event
.
getActionIndex
(),
packet
);
int
pointerChange
=
getPointerChangeForAction
(
event
.
getActionMasked
());
if
(
maskedAction
==
MotionEvent
.
ACTION_DOWN
||
maskedAction
==
MotionEvent
.
ACTION_POINTER_DOWN
)
{
// ACTION_DOWN and ACTION_POINTER_DOWN always apply to a single pointer only.
addPointerForIndex
(
event
,
event
.
getActionIndex
(),
pointerChange
,
0
,
packet
);
}
else
if
(
maskedAction
==
MotionEvent
.
ACTION_UP
||
maskedAction
==
MotionEvent
.
ACTION_POINTER_UP
)
{
// ACTION_UP and ACTION_POINTER_UP may contain position updates for other pointers.
// We are converting these updates to move events here in order to preserve this data.
// We also mark these events with a flag in order to help the framework reassemble
// the original Android event later, should it need to forward it to a PlatformView.
for
(
int
p
=
0
;
p
<
pointerCount
;
p
++)
{
if
(
p
!=
event
.
getActionIndex
())
{
if
(
event
.
getToolType
(
p
)
==
MotionEvent
.
TOOL_TYPE_FINGER
)
{
addPointerForIndex
(
event
,
p
,
kPointerChangeMove
,
kPointerDataFlagBatched
,
packet
);
}
}
}
// It's important that we're sending the UP event last. This allows PlatformView
// to correctly batch everything back into the original Android event if needed.
addPointerForIndex
(
event
,
event
.
getActionIndex
(),
pointerChange
,
0
,
packet
);
}
else
{
// ACTION_MOVE may not actually mean all pointers have moved
// but it's the responsibility of a later part of the system to
// ignore 0-deltas if desired.
for
(
int
p
=
0
;
p
<
pointerCount
;
p
++)
{
addPointerForIndex
(
event
,
p
,
packet
);
addPointerForIndex
(
event
,
p
,
p
ointerChange
,
0
,
p
acket
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录