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
Show 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 {
...
@@ -636,6 +636,9 @@ abstract class RenderBox extends RenderObject {
/// Convert the given point from the global coodinate system to the local
/// Convert the given point from the global coodinate system to the local
/// coordinate system for this box.
/// 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
)
{
Point
globalToLocal
(
Point
point
)
{
assert
(
attached
);
assert
(
attached
);
Matrix4
transform
=
new
Matrix4
.
identity
();
Matrix4
transform
=
new
Matrix4
.
identity
();
...
@@ -645,8 +648,9 @@ abstract class RenderBox extends RenderObject {
...
@@ -645,8 +648,9 @@ abstract class RenderBox extends RenderObject {
rendererParent
.
applyPaintTransform
(
renderer
,
transform
);
rendererParent
.
applyPaintTransform
(
renderer
,
transform
);
renderer
=
rendererParent
;
renderer
=
rendererParent
;
}
}
/* double det = */
transform
.
invert
();
double
det
=
transform
.
invert
();
// TODO(abarth): Check the determinant for degeneracy.
if
(
det
==
0.0
)
return
Point
.
origin
;
return
_transformPoint
(
transform
,
point
);
return
_transformPoint
(
transform
,
point
);
}
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
15eeb7f5
...
@@ -991,9 +991,14 @@ class RenderTransform extends RenderProxyBox {
...
@@ -991,9 +991,14 @@ class RenderTransform extends RenderProxyBox {
bool
hitTest
(
HitTestResult
result
,
{
Point
position
})
{
bool
hitTest
(
HitTestResult
result
,
{
Point
position
})
{
if
(
transformHitTests
)
{
if
(
transformHitTests
)
{
Matrix4
inverse
=
new
Matrix4
.
zero
();
Matrix4
inverse
;
// TODO(abarth): Check the determinant for degeneracy.
try
{
inverse
.
copyInverse
(
_effectiveTransform
);
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
position3
=
new
Vector3
(
position
.
x
,
position
.
y
,
0.0
);
Vector3
transformed3
=
inverse
.
transform3
(
position3
);
Vector3
transformed3
=
inverse
.
transform3
(
position3
);
position
=
new
Point
(
transformed3
.
x
,
transformed3
.
y
);
position
=
new
Point
(
transformed3
.
x
,
transformed3
.
y
);
...
...
packages/flutter/pubspec.yaml
View file @
15eeb7f5
...
@@ -10,7 +10,7 @@ dependencies:
...
@@ -10,7 +10,7 @@ dependencies:
material_design_icons
:
'
>=0.0.3
<0.1.0'
material_design_icons
:
'
>=0.0.3
<0.1.0'
sky_engine
:
0.0.81
sky_engine
:
0.0.81
sky_services
:
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'
quiver
:
'
>=0.21.4
<0.22.0'
# See the comment in flutter_tools' pubspec.yaml. We have to pin it
# 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