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
15eeb7f5
Commit
15eeb7f5
authored
Jan 13, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1235 from abarth/handle_degenerate_transforms
Handle degenerate transforms better
parents
193ed22b
192c6e24
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
box.dart
packages/flutter/lib/src/rendering/box.dart
+6
-2
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+8
-3
pubspec.yaml
packages/flutter/pubspec.yaml
+1
-1
No files found.
packages/flutter/lib/src/rendering/box.dart
View file @
15eeb7f5
...
...
@@ -636,6 +636,9 @@ abstract class RenderBox extends RenderObject {
/// Convert the given point from the global coodinate system to the local
/// coordinate system for this box.
///
/// If the transform from global coordinates to local coordinates is
/// degenerate, this function returns Point.origin.
Point
globalToLocal
(
Point
point
)
{
assert
(
attached
);
Matrix4
transform
=
new
Matrix4
.
identity
();
...
...
@@ -645,8 +648,9 @@ abstract class RenderBox extends RenderObject {
rendererParent
.
applyPaintTransform
(
renderer
,
transform
);
renderer
=
rendererParent
;
}
/* double det = */
transform
.
invert
();
// TODO(abarth): Check the determinant for degeneracy.
double
det
=
transform
.
invert
();
if
(
det
==
0.0
)
return
Point
.
origin
;
return
_transformPoint
(
transform
,
point
);
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
15eeb7f5
...
...
@@ -991,9 +991,14 @@ class RenderTransform extends RenderProxyBox {
bool
hitTest
(
HitTestResult
result
,
{
Point
position
})
{
if
(
transformHitTests
)
{
Matrix4
inverse
=
new
Matrix4
.
zero
();
// TODO(abarth): Check the determinant for degeneracy.
inverse
.
copyInverse
(
_effectiveTransform
);
Matrix4
inverse
;
try
{
inverse
=
new
Matrix4
.
inverted
(
_effectiveTransform
);
}
catch
(
e
)
{
// We cannot invert the effective transform. That means the child
// doesn't appear on screen and cannot be hit.
return
false
;
}
Vector3
position3
=
new
Vector3
(
position
.
x
,
position
.
y
,
0.0
);
Vector3
transformed3
=
inverse
.
transform3
(
position3
);
position
=
new
Point
(
transformed3
.
x
,
transformed3
.
y
);
...
...
packages/flutter/pubspec.yaml
View file @
15eeb7f5
...
...
@@ -10,7 +10,7 @@ dependencies:
material_design_icons
:
'
>=0.0.3
<0.1.0'
sky_engine
:
0.0.81
sky_services
:
0.0.81
vector_math
:
'
>=1.4.
3
<2.0.0'
vector_math
:
'
>=1.4.
5
<2.0.0'
quiver
:
'
>=0.21.4
<0.22.0'
# See the comment in flutter_tools' pubspec.yaml. We have to pin it
...
...
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