Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
16471d92
Commit
16471d92
authored
Nov 13, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #353 from Hixie/hit-testing-cleanup
Hit Testing Cleanup
parents
876459e8
92b9d91a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+2
-10
box.dart
packages/flutter/lib/src/rendering/box.dart
+5
-1
hit_test.dart
packages/flutter/lib/src/rendering/hit_test.dart
+7
-3
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
16471d92
...
...
@@ -31,14 +31,6 @@ int _hammingWeight(int value) {
return
weight
;
}
/// A hit test entry used by [FlutterBinding]
class
BindingHitTestEntry
extends
HitTestEntry
{
const
BindingHitTestEntry
(
HitTestTarget
target
,
this
.
result
)
:
super
(
target
);
/// The result of the hit test
final
HitTestResult
result
;
}
/// State used in converting PointerPackets to PointerInputEvents
class
_PointerState
{
_PointerState
({
this
.
pointer
,
this
.
lastPosition
});
...
...
@@ -269,7 +261,7 @@ class FlutterBinding extends HitTestTarget {
HitTestResult
hitTest
(
Point
position
)
{
HitTestResult
result
=
new
HitTestResult
();
_renderView
.
hitTest
(
result
,
position:
position
);
result
.
add
(
new
BindingHitTestEntry
(
this
,
result
));
result
.
add
(
new
HitTestEntry
(
this
));
return
result
;
}
...
...
@@ -280,7 +272,7 @@ class FlutterBinding extends HitTestTarget {
entry
.
target
.
handleEvent
(
event
,
entry
);
}
void
handleEvent
(
InputEvent
e
,
Binding
HitTestEntry
entry
)
{
void
handleEvent
(
InputEvent
e
,
HitTestEntry
entry
)
{
if
(
e
is
PointerInputEvent
)
{
PointerInputEvent
event
=
e
;
pointerRouter
.
route
(
event
);
...
...
packages/flutter/lib/src/rendering/box.dart
View file @
16471d92
...
...
@@ -275,10 +275,14 @@ class BoxConstraints extends Constraints {
/// A hit test entry used by [RenderBox]
class
BoxHitTestEntry
extends
HitTestEntry
{
const
BoxHitTestEntry
(
HitTestTarget
target
,
this
.
localPosition
)
:
super
(
target
);
const
BoxHitTestEntry
(
RenderBox
target
,
this
.
localPosition
)
:
super
(
target
);
RenderBox
get
target
=>
super
.
target
;
/// The position of the hit test in the local coordinates of [target]
final
Point
localPosition
;
String
toString
()
=>
'
${target.runtimeType}
@
$localPosition
'
;
}
/// Parent data used by [RenderBox] and its subclasses
...
...
packages/flutter/lib/src/rendering/hit_test.dart
View file @
16471d92
...
...
@@ -19,12 +19,14 @@ class HitTestEntry {
/// The [HitTestTarget] encountered during the hit test.
final
HitTestTarget
target
;
String
toString
()
=>
'
$target
'
;
}
/// The result of performing a hit test.
class
HitTestResult
{
HitTestResult
({
List
<
HitTestEntry
>
path
})
:
path
=
path
!=
null
?
path
:
new
List
<
HitTestEntry
>()
;
:
path
=
path
??
<
HitTestEntry
>[]
;
/// The list of [HitTestEntry] objects recorded during the hit test.
///
...
...
@@ -36,9 +38,11 @@ class HitTestResult {
/// Add a [HitTestEntry] to the path.
///
/// The new entry is added at the end of the path, which means entries should
/// be added in order from most specific to least specific, typically during a
/// upward walk
in
the tree being hit tested.
/// be added in order from most specific to least specific, typically during a
n
/// upward walk
of
the tree being hit tested.
void
add
(
HitTestEntry
entry
)
{
path
.
add
(
entry
);
}
String
toString
()
=>
'HitTestResult(
${path.isEmpty ? "<empty path>" : path.join(", ")}
)'
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment