Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
cd74be10
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,发现更多精彩内容 >>
提交
cd74be10
编写于
10月 27, 2015
作者:
I
Ian Hickson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1836 from Hixie/metrics-changed
Notification of metrics changes.
上级
5855f722
e34aefbd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
7 deletion
+17
-7
sky/packages/sky/lib/src/rendering/binding.dart
sky/packages/sky/lib/src/rendering/binding.dart
+17
-7
未找到文件。
sky/packages/sky/lib/src/rendering/binding.dart
浏览文件 @
cd74be10
...
@@ -13,6 +13,9 @@ import 'hit_test.dart';
...
@@ -13,6 +13,9 @@ import 'hit_test.dart';
import
'object.dart'
;
import
'object.dart'
;
import
'view.dart'
;
import
'view.dart'
;
typedef
void
EventListener
(
InputEvent
event
);
typedef
void
MetricListener
(
Size
size
);
int
_hammingWeight
(
int
value
)
{
int
_hammingWeight
(
int
value
)
{
if
(
value
==
0
)
if
(
value
==
0
)
return
0
;
return
0
;
...
@@ -24,8 +27,6 @@ int _hammingWeight(int value) {
...
@@ -24,8 +27,6 @@ int _hammingWeight(int value) {
return
weight
;
return
weight
;
}
}
typedef
void
EventListener
(
InputEvent
event
);
/// A hit test entry used by [FlutterBinding]
/// A hit test entry used by [FlutterBinding]
class
BindingHitTestEntry
extends
HitTestEntry
{
class
BindingHitTestEntry
extends
HitTestEntry
{
const
BindingHitTestEntry
(
HitTestTarget
target
,
this
.
result
)
:
super
(
target
);
const
BindingHitTestEntry
(
HitTestTarget
target
,
this
.
result
)
:
super
(
target
);
...
@@ -137,7 +138,7 @@ class FlutterBinding extends HitTestTarget {
...
@@ -137,7 +138,7 @@ class FlutterBinding extends HitTestTarget {
if
(
renderViewOverride
==
null
)
{
if
(
renderViewOverride
==
null
)
{
_renderView
=
new
RenderView
(
child:
root
);
_renderView
=
new
RenderView
(
child:
root
);
_renderView
.
attach
();
_renderView
.
attach
();
_
renderView
.
rootConstraints
=
_createConstraints
();
_
handleMetricsChanged
();
_renderView
.
scheduleInitialFrame
();
_renderView
.
scheduleInitialFrame
();
}
else
{
}
else
{
_renderView
=
renderViewOverride
;
_renderView
=
renderViewOverride
;
...
@@ -156,11 +157,19 @@ class FlutterBinding extends HitTestTarget {
...
@@ -156,11 +157,19 @@ class FlutterBinding extends HitTestTarget {
RenderView
get
renderView
=>
_renderView
;
RenderView
get
renderView
=>
_renderView
;
RenderView
_renderView
;
RenderView
_renderView
;
ViewConstraints
_createConstraints
()
{
final
List
<
MetricListener
>
_metricListeners
=
new
List
<
MetricListener
>();
return
new
ViewConstraints
(
size:
new
Size
(
ui
.
view
.
width
,
ui
.
view
.
height
));
}
/// Calls listener for every event that isn't localized to a given view coordinate
void
addMetricListener
(
MetricListener
listener
)
=>
_metricListeners
.
add
(
listener
);
/// Stops calling listener for every event that isn't localized to a given view coordinate
bool
removeMetricListener
(
MetricListener
listener
)
=>
_metricListeners
.
remove
(
listener
);
void
_handleMetricsChanged
()
{
void
_handleMetricsChanged
()
{
_renderView
.
rootConstraints
=
_createConstraints
();
Size
size
=
new
Size
(
ui
.
view
.
width
,
ui
.
view
.
height
);
_renderView
.
rootConstraints
=
new
ViewConstraints
(
size:
size
);
for
(
MetricListener
listener
in
_metricListeners
)
listener
(
size
);
}
}
/// Pump the rendering pipeline to generate a frame for the given time stamp
/// Pump the rendering pipeline to generate a frame for the given time stamp
...
@@ -184,6 +193,7 @@ class FlutterBinding extends HitTestTarget {
...
@@ -184,6 +193,7 @@ class FlutterBinding extends HitTestTarget {
if
(
ourEvent
is
PointerInputEvent
)
{
if
(
ourEvent
is
PointerInputEvent
)
{
_handlePointerInputEvent
(
ourEvent
);
_handlePointerInputEvent
(
ourEvent
);
}
else
{
}
else
{
assert
(
event
.
type
==
'back'
);
for
(
EventListener
listener
in
_eventListeners
)
for
(
EventListener
listener
in
_eventListeners
)
listener
(
ourEvent
);
listener
(
ourEvent
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录