Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
2d95d0ad
E
engine
项目概览
liujiuri
/
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,发现更多精彩内容 >>
提交
2d95d0ad
编写于
12月 08, 2015
作者:
I
Ian Hickson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2153 from Hixie/mojo-pointer
Fix pointers in mojo.
上级
4b6b0311
07aa4291
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
16 deletion
+51
-16
sky/shell/platform/mojo/platform_view_mojo.cc
sky/shell/platform/mojo/platform_view_mojo.cc
+47
-16
sky/shell/platform/mojo/platform_view_mojo.h
sky/shell/platform/mojo/platform_view_mojo.h
+4
-0
未找到文件。
sky/shell/platform/mojo/platform_view_mojo.cc
浏览文件 @
2d95d0ad
...
...
@@ -130,22 +130,33 @@ void PlatformViewMojo::OnEvent(mojo::EventPtr event,
mojo
::
PointerDataPtr
data
=
event
->
pointer_data
.
Pass
();
if
(
!
data
)
break
;
pointer
::
PointerPtr
pointer
=
pointer
::
Pointer
::
New
();
pointer
->
time_stamp
=
event
->
time_stamp
;
pointer
->
pointer
=
data
->
pointer_id
;
pointer
->
type
=
GetTypeFromAction
(
event
->
action
);
pointer
->
kind
=
GetKindFromKind
(
data
->
kind
);
pointer
->
x
=
data
->
x
;
pointer
->
y
=
data
->
y
;
pointer
->
buttons
=
static_cast
<
int32_t
>
(
event
->
flags
);
pointer
->
pressure
=
data
->
pressure
;
pointer
->
radius_major
=
data
->
radius_major
;
pointer
->
radius_minor
=
data
->
radius_minor
;
pointer
->
orientation
=
data
->
orientation
;
pointer
::
PointerPacketPtr
packet
=
pointer
::
PointerPacket
::
New
();
packet
->
pointers
=
mojo
::
Array
<
pointer
::
PointerPtr
>::
New
(
1
);
packet
->
pointers
[
0
]
=
pointer
.
Pass
();
pointer
::
PointerPacketPtr
packet
;
int
packetIndex
=
0
;
if
(
pointer_positions_
.
count
(
data
->
pointer_id
)
>
0
)
{
if
(
event
->
action
==
mojo
::
EventType
::
POINTER_UP
||
event
->
action
==
mojo
::
EventType
::
POINTER_CANCEL
)
{
std
::
pair
<
float
,
float
>
last_position
=
pointer_positions_
[
data
->
pointer_id
];
if
(
last_position
.
first
!=
data
->
x
||
last_position
.
second
!=
data
->
y
)
{
packet
=
pointer
::
PointerPacket
::
New
();
packet
->
pointers
=
mojo
::
Array
<
pointer
::
PointerPtr
>::
New
(
2
);
packet
->
pointers
[
packetIndex
]
=
CreateEvent
(
pointer
::
PointerType
::
MOVE
,
event
.
get
(),
data
.
get
());
packetIndex
+=
1
;
}
pointer_positions_
.
erase
(
data
->
pointer_id
);
}
}
else
{
// We don't currently support hover moves.
// If we want to support those, we have to first implement
// added/removed events for pointers.
// See: https://github.com/flutter/flutter/issues/720
if
(
event
->
action
!=
mojo
::
EventType
::
POINTER_DOWN
)
break
;
}
if
(
packetIndex
==
0
)
{
packet
=
pointer
::
PointerPacket
::
New
();
packet
->
pointers
=
mojo
::
Array
<
pointer
::
PointerPtr
>::
New
(
1
);
}
packet
->
pointers
[
packetIndex
]
=
CreateEvent
(
GetTypeFromAction
(
event
->
action
),
event
.
get
(),
data
.
get
());
sky_engine_
->
OnPointerPacket
(
packet
.
Pass
());
break
;
}
...
...
@@ -162,6 +173,26 @@ void PlatformViewMojo::OnEvent(mojo::EventPtr event,
callback
.
Run
();
}
pointer
::
PointerPtr
PlatformViewMojo
::
CreateEvent
(
pointer
::
PointerType
type
,
mojo
::
Event
*
event
,
mojo
::
PointerData
*
data
)
{
DCHECK
(
data
);
pointer
::
PointerPtr
pointer
=
pointer
::
Pointer
::
New
();
pointer
->
time_stamp
=
event
->
time_stamp
;
pointer
->
pointer
=
data
->
pointer_id
;
pointer
->
type
=
type
;
pointer
->
kind
=
GetKindFromKind
(
data
->
kind
);
pointer
->
x
=
data
->
x
;
pointer
->
y
=
data
->
y
;
pointer
->
buttons
=
static_cast
<
int32_t
>
(
event
->
flags
);
pointer
->
pressure
=
data
->
pressure
;
pointer
->
radius_major
=
data
->
radius_major
;
pointer
->
radius_minor
=
data
->
radius_minor
;
pointer
->
orientation
=
data
->
orientation
;
if
(
event
->
action
!=
mojo
::
EventType
::
POINTER_UP
||
event
->
action
!=
mojo
::
EventType
::
POINTER_CANCEL
)
pointer_positions_
[
data
->
pointer_id
]
=
{
data
->
x
,
data
->
y
};
return
pointer
.
Pass
();
}
void
PlatformViewMojo
::
Create
(
mojo
::
ApplicationConnection
*
connection
,
mojo
::
InterfaceRequest
<
keyboard
::
KeyboardService
>
request
)
{
...
...
sky/shell/platform/mojo/platform_view_mojo.h
浏览文件 @
2d95d0ad
...
...
@@ -37,6 +37,8 @@ class PlatformViewMojo : public PlatformView,
void
OnEvent
(
mojo
::
EventPtr
event
,
const
mojo
::
Callback
<
void
()
>&
callback
)
override
;
pointer
::
PointerPtr
CreateEvent
(
pointer
::
PointerType
type
,
mojo
::
Event
*
event
,
mojo
::
PointerData
*
data
);
// |mojo::InterfaceFactory<mojo::asset_bundle::AssetUnpacker>| implementation:
void
Create
(
mojo
::
ApplicationConnection
*
connection
,
...
...
@@ -53,6 +55,8 @@ class PlatformViewMojo : public PlatformView,
mojo
::
NativeViewportEventDispatcherPtr
key_event_dispatcher_
;
std
::
map
<
int
,
std
::
pair
<
float
,
float
>>
pointer_positions_
;
DISALLOW_COPY_AND_ASSIGN
(
PlatformViewMojo
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录