Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
20ee4e3e
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,发现更多精彩内容 >>
未验证
提交
20ee4e3e
编写于
12月 27, 2018
作者:
A
Amir Hardon
提交者:
GitHub
12月 27, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Only reject gestures to embedded UIViews when the framework says so. (#7307)" (#7313)
This reverts commit
cc9c6702
.
上级
28e152f7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
52 deletion
+18
-52
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
...tform/darwin/ios/framework/Source/FlutterPlatformViews.mm
+18
-48
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
...rwin/ios/framework/Source/FlutterPlatformViews_Internal.h
+0
-4
未找到文件。
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
浏览文件 @
20ee4e3e
...
...
@@ -29,8 +29,6 @@ void FlutterPlatformViewsController::OnMethodCall(FlutterMethodCall* call, Flutt
OnDispose
(
call
,
result
);
}
else
if
([[
call
method
]
isEqualToString
:
@"acceptGesture"
])
{
OnAcceptGesture
(
call
,
result
);
}
else
if
([[
call
method
]
isEqualToString
:
@"rejectGesture"
])
{
OnRejectGesture
(
call
,
result
);
}
else
{
result
(
FlutterMethodNotImplemented
);
}
...
...
@@ -127,24 +125,6 @@ void FlutterPlatformViewsController::OnAcceptGesture(FlutterMethodCall* call,
result
(
nil
);
}
void
FlutterPlatformViewsController
::
OnRejectGesture
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
)
{
NSDictionary
<
NSString
*
,
id
>*
args
=
[
call
arguments
];
int64_t
viewId
=
[
args
[
@"id"
]
longLongValue
];
if
(
views_
.
count
(
viewId
)
==
0
)
{
result
([
FlutterError
errorWithCode
:
@"unknown_view"
message:
@"trying to set gesture state for an unknown view"
details:
[
NSString
stringWithFormat
:
@"view id: '%lld'"
,
viewId
]]);
return
;
}
FlutterTouchInterceptingView
*
view
=
touch_interceptors_
[
viewId
].
get
();
[
view
blockGesture
];
result
(
nil
);
}
void
FlutterPlatformViewsController
::
RegisterViewFactory
(
NSObject
<
FlutterPlatformViewFactory
>*
factory
,
NSString
*
factoryId
)
{
...
...
@@ -289,9 +269,6 @@ void FlutterPlatformViewsController::EnsureGLOverlayInitialized(
// invoking an acceptGesture method on the platform_views channel). And this is how we allow the
// Flutter framework to delay or prevent the embedded view from getting a touch sequence.
@interface
DelayingGestureRecognizer
:
UIGestureRecognizer
<
UIGestureRecognizerDelegate
>
-
(
instancetype
)
initWithTarget
:(
id
)
target
action
:(
SEL
)
action
forwardingRecognizer
:(
UIGestureRecognizer
*
)
forwardingRecognizer
;
@end
// While the DelayingGestureRecognizer is preventing touches from hitting the responder chain
...
...
@@ -324,10 +301,7 @@ void FlutterPlatformViewsController::EnsureGLOverlayInitialized(
[[[
ForwardingGestureRecognizer
alloc
]
initWithTarget
:
self
flutterView:
flutterView
]
autorelease
];
_delayingRecognizer
.
reset
([[
DelayingGestureRecognizer
alloc
]
initWithTarget:
self
action:
nil
forwardingRecognizer:
forwardingRecognizer
]);
_delayingRecognizer
.
reset
([[
DelayingGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
nil
]);
[
self
addGestureRecognizer
:
_delayingRecognizer
.
get
()];
[
self
addGestureRecognizer
:
forwardingRecognizer
];
...
...
@@ -338,34 +312,21 @@ void FlutterPlatformViewsController::EnsureGLOverlayInitialized(
-
(
void
)
releaseGesture
{
_delayingRecognizer
.
get
().
state
=
UIGestureRecognizerStateFailed
;
}
-
(
void
)
blockGesture
{
_delayingRecognizer
.
get
().
state
=
UIGestureRecognizerStateEnded
;
}
@end
@implementation
DelayingGestureRecognizer
{
fml
::
scoped_nsobject
<
UIGestureRecognizer
>
_forwardingRecognizer
;
}
-
(
instancetype
)
initWithTarget
:(
id
)
target
action
:(
SEL
)
action
forwardingRecognizer
:(
UIGestureRecognizer
*
)
forwardingRecognizer
{
@implementation
DelayingGestureRecognizer
-
(
instancetype
)
initWithTarget
:(
id
)
target
action
:(
SEL
)
action
{
self
=
[
super
initWithTarget
:
target
action
:
action
];
if
(
self
)
{
self
.
delaysTouchesBegan
=
YES
;
self
.
delegate
=
self
;
_forwardingRecognizer
.
reset
(
forwardingRecognizer
);
}
return
self
;
}
-
(
BOOL
)
gestureRecognizer
:(
UIGestureRecognizer
*
)
gestureRecognizer
shouldBeRequiredToFailByGestureRecognizer
:(
UIGestureRecognizer
*
)
otherGestureRecognizer
{
// The forwarding gesture recognizer should always get all touch events, so it should not be
// required to fail by any other gesture recognizer.
return
otherGestureRecognizer
!=
_forwardingRecognizer
.
get
()
&&
otherGestureRecognizer
!=
self
;
return
otherGestureRecognizer
!=
self
;
}
-
(
BOOL
)
gestureRecognizer
:(
UIGestureRecognizer
*
)
gestureRecognizer
...
...
@@ -373,12 +334,21 @@ void FlutterPlatformViewsController::EnsureGLOverlayInitialized(
return
otherGestureRecognizer
==
self
;
}
-
(
void
)
touchesBegan
:(
NSSet
*
)
touches
withEvent
:(
UIEvent
*
)
event
{
self
.
state
=
UIGestureRecognizerStateBegan
;
-
(
void
)
touchesEnded
:(
NSSet
*
)
touches
withEvent
:(
UIEvent
*
)
event
{
// The gesture has ended, and the delaying gesture recognizer was not failed, we recognize
// the gesture to prevent the touches from being dispatched to the embedded view.
//
// This doesn't work well with gestures that are recognized by the Flutter framework after
// all pointers are up.
//
// TODO(amirh): explore if we can instead set this to recognized when the next touch sequence
// begins, or we can use a framework signal for restarting the recognizers (e.g when the
// gesture arena is resolved).
self
.
state
=
UIGestureRecognizerStateRecognized
;
}
-
(
void
)
touchesCancelled
:(
NSSet
*
)
touches
withEvent
:(
UIEvent
*
)
event
{
self
.
state
=
UIGestureRecognizerState
Cancell
ed
;
self
.
state
=
UIGestureRecognizerState
Recogniz
ed
;
}
@end
...
...
@@ -410,12 +380,12 @@ void FlutterPlatformViewsController::EnsureGLOverlayInitialized(
-
(
void
)
touchesEnded
:(
NSSet
*
)
touches
withEvent
:(
UIEvent
*
)
event
{
[
_flutterView
touchesEnded
:
touches
withEvent
:
event
];
self
.
state
=
UIGestureRecognizerState
End
ed
;
self
.
state
=
UIGestureRecognizerState
Recogniz
ed
;
}
-
(
void
)
touchesCancelled
:(
NSSet
*
)
touches
withEvent
:(
UIEvent
*
)
event
{
[
_flutterView
touchesCancelled
:
touches
withEvent
:
event
];
self
.
state
=
UIGestureRecognizerState
Cancell
ed
;
self
.
state
=
UIGestureRecognizerState
Recogniz
ed
;
}
-
(
BOOL
)
gestureRecognizer
:(
UIGestureRecognizer
*
)
gestureRecognizer
...
...
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
浏览文件 @
20ee4e3e
...
...
@@ -22,9 +22,6 @@
// Stop delaying any active touch sequence (and let it arrive the embedded view).
-
(
void
)
releaseGesture
;
// Prevent the touch sequence from ever arriving to the embedded view.
-
(
void
)
blockGesture
;
@end
namespace
shell
{
...
...
@@ -92,7 +89,6 @@ class FlutterPlatformViewsController {
void
OnCreate
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
);
void
OnDispose
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
);
void
OnAcceptGesture
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
);
void
OnRejectGesture
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
);
void
EnsureOverlayInitialized
(
int64_t
overlay_id
);
void
EnsureGLOverlayInitialized
(
int64_t
overlay_id
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录