Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
a399d95b
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
a399d95b
编写于
11月 11, 2015
作者:
C
Chinmay Garde
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move to the services/pointer Mojo interface for touch events on iOS
上级
cc81c2fb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
27 deletion
+46
-27
sky/shell/BUILD.gn
sky/shell/BUILD.gn
+1
-0
sky/shell/ios/sky_surface.mm
sky/shell/ios/sky_surface.mm
+45
-27
未找到文件。
sky/shell/BUILD.gn
浏览文件 @
a399d95b
...
...
@@ -23,6 +23,7 @@ common_deps = [
"//sky/engine/tonic",
"//sky/engine/wtf",
"//sky/services/engine:interfaces",
"//sky/services/pointer:interfaces",
"//sky/services/vsync:interfaces",
"//sky/shell/dart",
"//ui/gfx/geometry",
...
...
sky/shell/ios/sky_surface.mm
浏览文件 @
a399d95b
...
...
@@ -11,6 +11,7 @@
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "sky/services/engine/input_event.mojom.h"
#include "sky/services/pointer/pointer.mojom.h"
#include "sky/shell/mac/platform_view_mac.h"
#include "sky/shell/shell_view.h"
#include "sky/shell/shell.h"
...
...
@@ -23,28 +24,29 @@ enum MapperPhase {
Removed
,
};
using
EventTypeMapperPhase
=
std
::
pair
<
sky
::
Event
Type
,
MapperPhase
>
;
static
inline
EventTypeMapperPhase
Event
TypePhaseFromUITouchPhase
(
using
PointerTypeMapperPhase
=
std
::
pair
<
pointer
::
Pointer
Type
,
MapperPhase
>
;
static
inline
PointerTypeMapperPhase
Pointer
TypePhaseFromUITouchPhase
(
UITouchPhase
phase
)
{
switch
(
phase
)
{
case
UITouchPhaseBegan
:
return
EventTypeMapperPhase
(
sky
::
EventType
::
POINTER_
DOWN
,
MapperPhase
::
Added
);
return
PointerTypeMapperPhase
(
pointer
::
PointerType
::
DOWN
,
MapperPhase
::
Added
);
case
UITouchPhaseMoved
:
case
UITouchPhaseStationary
:
// There is no EVENT_TYPE_POINTER_STATIONARY. So we just pass a move type
// with the same coordinates
return
EventTypeMapperPhase
(
sky
::
EventType
::
POINTER_
MOVE
,
MapperPhase
::
Accessed
);
return
PointerTypeMapperPhase
(
pointer
::
PointerType
::
MOVE
,
MapperPhase
::
Accessed
);
case
UITouchPhaseEnded
:
return
EventTypeMapperPhase
(
sky
::
EventType
::
POINTER_
UP
,
MapperPhase
::
Removed
);
return
PointerTypeMapperPhase
(
pointer
::
PointerType
::
UP
,
MapperPhase
::
Removed
);
case
UITouchPhaseCancelled
:
return
EventTypeMapperPhase
(
sky
::
EventType
::
POINTER_
CANCEL
,
MapperPhase
::
Removed
);
return
PointerTypeMapperPhase
(
pointer
::
PointerType
::
CANCEL
,
MapperPhase
::
Removed
);
}
return
EventTypeMapperPhase
(
sky
::
EventType
::
UNKNOWN
,
MapperPhase
::
Accessed
);
return
PointerTypeMapperPhase
(
pointer
::
PointerType
::
CANCEL
,
MapperPhase
::
Accessed
);
}
static
inline
int64
InputEventTimestampFromNSTimeInterval
(
...
...
@@ -195,17 +197,11 @@ static std::string SkPictureTracingPath() {
#pragma mark - UIResponder overrides for raw touches
-
(
void
)
dispatchTouches
:(
NSSet
*
)
touches
phase
:(
UITouchPhase
)
phase
{
auto
eventTypePhase
=
Event
TypePhaseFromUITouchPhase
(
phase
);
auto
eventTypePhase
=
Pointer
TypePhaseFromUITouchPhase
(
phase
);
const
CGFloat
scale
=
[
UIScreen
mainScreen
].
scale
;
auto
pointer_packet
=
pointer
::
PointerPacket
::
New
();
for
(
UITouch
*
touch
in
touches
)
{
auto
input
=
sky
::
InputEvent
::
New
();
input
->
type
=
eventTypePhase
.
first
;
input
->
time_stamp
=
InputEventTimestampFromNSTimeInterval
(
touch
.
timestamp
);
input
->
pointer_data
=
sky
::
PointerData
::
New
();
input
->
pointer_data
->
kind
=
sky
::
PointerKind
::
TOUCH
;
int
touch_identifier
=
0
;
uintptr_t
touch_ptr
=
reinterpret_cast
<
uintptr_t
>
(
touch
);
...
...
@@ -220,17 +216,39 @@ static std::string SkPictureTracingPath() {
touch_identifier
=
_touch_mapper
.
unregisterTouch
(
touch_ptr
);
break
;
}
DCHECK
(
touch_identifier
!=
0
);
input
->
pointer_data
->
pointer
=
touch_identifier
;
CGPoint
windowCoordinates
=
[
touch
locationInView
:
nil
];
input
->
pointer_data
->
x
=
windowCoordinates
.
x
*
scale
;
input
->
pointer_data
->
y
=
windowCoordinates
.
y
*
scale
;
_sky_engine
->
OnInputEvent
(
input
.
Pass
());
auto
pointer_time
=
InputEventTimestampFromNSTimeInterval
(
touch
.
timestamp
);
auto
pointer_data
=
pointer
::
Pointer
::
New
();
pointer_data
->
time_stamp
=
pointer_time
;
pointer_data
->
type
=
eventTypePhase
.
first
;
pointer_data
->
kind
=
pointer
::
PointerKind
::
TOUCH
;
pointer_data
->
pointer
=
touch_identifier
;
pointer_data
->
x
=
windowCoordinates
.
x
*
scale
;
pointer_data
->
y
=
windowCoordinates
.
y
*
scale
;
pointer_data
->
buttons
=
0
;
pointer_data
->
down
=
false
;
pointer_data
->
primary
=
false
;
pointer_data
->
obscured
=
false
;
pointer_data
->
pressure
=
1.0
;
pointer_data
->
pressure_min
=
0.0
;
pointer_data
->
pressure_max
=
1.0
;
pointer_data
->
distance
=
0.0
;
pointer_data
->
distance_min
=
0.0
;
pointer_data
->
distance_max
=
0.0
;
pointer_data
->
radius_major
=
0.0
;
pointer_data
->
radius_minor
=
0.0
;
pointer_data
->
radius_min
=
0.0
;
pointer_data
->
radius_max
=
0.0
;
pointer_data
->
orientation
=
0.0
;
pointer_data
->
tilt
=
0.0
;
pointer_packet
->
pointers
.
push_back
(
pointer_data
.
Pass
());
}
_sky_engine
->
OnPointerPacket
(
pointer_packet
.
Pass
());
}
-
(
void
)
touchesBegan
:(
NSSet
*
)
touches
withEvent
:(
UIEvent
*
)
event
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录