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
98f2c78e
Commit
98f2c78e
authored
Oct 26, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1777 from Hixie/debug-touches
debugPaintPointersEnabled mode
parents
6c0635ca
76381b8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
box.dart
packages/flutter/lib/src/rendering/box.dart
+25
-0
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+6
-0
object.dart
packages/flutter/lib/src/rendering/object.dart
+2
-3
No files found.
packages/flutter/lib/src/rendering/box.dart
View file @
98f2c78e
...
...
@@ -5,6 +5,7 @@
import
'dart:math'
as
math
;
import
'dart:ui'
as
ui
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
...
...
@@ -620,11 +621,28 @@ abstract class RenderBox extends RenderObject {
/// The returned paint bounds are in the local coordinate system of this box.
Rect
get
paintBounds
=>
Point
.
origin
&
size
;
int
_debugActivePointers
=
0
;
void
handleEvent
(
InputEvent
event
,
HitTestEntry
entry
)
{
super
.
handleEvent
(
event
,
entry
);
assert
(()
{
if
(
debugPaintPointersEnabled
)
{
if
(
event
.
type
==
'pointerdown'
)
_debugActivePointers
+=
1
;
if
(
event
.
type
==
'pointerup'
||
event
.
type
==
'pointercancel'
)
_debugActivePointers
-=
1
;
markNeedsPaint
();
}
return
true
;
});
}
void
debugPaint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
debugPaintSizeEnabled
)
debugPaintSize
(
context
,
offset
);
if
(
debugPaintBaselinesEnabled
)
debugPaintBaselines
(
context
,
offset
);
if
(
debugPaintPointersEnabled
)
debugPaintPointers
(
context
,
offset
);
}
void
debugPaintSize
(
PaintingContext
context
,
Offset
offset
)
{
Paint
paint
=
new
Paint
()
...
...
@@ -657,6 +675,13 @@ abstract class RenderBox extends RenderObject {
context
.
canvas
.
drawPath
(
path
,
paint
);
}
}
void
debugPaintPointers
(
PaintingContext
context
,
Offset
offset
)
{
if
(
_debugActivePointers
>
0
)
{
Paint
paint
=
new
Paint
()
..
color
=
new
Color
(
debugPaintPointersColorValue
|
((
0x04000000
*
depth
)
&
0xFF000000
));
context
.
canvas
.
drawRect
(
offset
&
size
,
paint
);
}
}
String
debugDescribeSettings
(
String
prefix
)
=>
'
${super.debugDescribeSettings(prefix)}${prefix}
size:
${ hasSize ? size : "MISSING" }
\n
'
;
}
...
...
packages/flutter/lib/src/rendering/debug.dart
View file @
98f2c78e
...
...
@@ -30,6 +30,12 @@ ui.Color debugPaintLayerBordersColor = const ui.Color(0xFFFF9800);
/// Causes RenderObjects to paint warnings when painting outside their bounds.
bool
debugPaintBoundsEnabled
=
false
;
/// Causes RenderBox objects to flash while they are being tapped
bool
debugPaintPointersEnabled
=
false
;
/// The color to use when reporting pointers.
int
debugPaintPointersColorValue
=
0x00BBBB
;
/// The color to use when painting RenderError boxes in checked mode.
ui
.
Color
debugErrorBoxColor
=
const
ui
.
Color
(
0xFFFF0000
);
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
98f2c78e
...
...
@@ -1014,7 +1014,6 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
_debugDoingThisPaint
=
true
;
debugLastActivePaint
=
_debugActivePaint
;
_debugActivePaint
=
this
;
debugPaint
(
context
,
offset
);
if
(
debugPaintBoundsEnabled
)
{
context
.
canvas
.
save
();
context
.
canvas
.
clipRect
(
paintBounds
.
shift
(
offset
));
...
...
@@ -1031,6 +1030,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
_debugReportException
(
'paint'
,
e
,
stack
);
}
assert
(()
{
debugPaint
(
context
,
offset
);
if
(
debugPaintBoundsEnabled
)
context
.
canvas
.
restore
();
_debugActivePaint
=
debugLastActivePaint
;
...
...
@@ -1082,8 +1082,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
// EVENTS
/// Override this function to handle events that hit this render object
void
handleEvent
(
InputEvent
event
,
HitTestEntry
entry
)
{
}
void
handleEvent
(
InputEvent
event
,
HitTestEntry
entry
)
{
}
// HIT TESTING
...
...
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