-
Notifications
You must be signed in to change notification settings - Fork 6k
[OR] Offset.fromDirection and Size.aspectRatio #6805
Conversation
|
Completely untested code right now. :-) |
testing/dart/geometry_test.dart
Outdated
| expect(new Offset.fromDirection(pi / 2.0), const Offset(0.0, 1.0)); | ||
| expect(new Offset.fromDirection(-pi / 2.0), const Offset(0.0, -1.0)); | ||
| expect(new Offset.fromDirection(0.0), const Offset(1.0, 0.0)); | ||
| expect(new Offset.fromDirection(pi / 4.0), const Offset(1.0, 1.0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test succeed? Either the distance should be sqrt(2) or the expected value should be Offset(sqrt(2) / 2, sqrt(2) / 2), no? I also would worry that the floating point comparison would fail.
Same for some of the other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code was completely untested at the point where i pushed it, i wanted to get something on github so i could show a community member who was asking for it.
lib/ui/geometry.dart
Outdated
| /// | ||
| /// The distance can be omitted, to create a unit vector (distance = 1.0). | ||
| factory Offset.fromDirection(double direction, [ double distance = 1.0 ]) { | ||
| return new Offset(distance * math.cos(direction), - distance * math.sin(direction)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our style recommendation is to not use new anymore, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but this file hasn't been converted yet.
lib/ui/geometry.dart
Outdated
| /// ratio. | ||
| /// * [FittedBox], a widget that (in most modes) attempts to maintain a | ||
| /// child widget's aspect ratio while changing its size. | ||
| double get aspectRatio => dx / dy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to _dx / _dy or width / height
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, fixed.
|
Ok, this time it's actually been tested. |
jamesderlin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
@Hixie thanks 👍 |
|
Rebased and kicked bots, will land on green. |
flutter/engine@101b27d...4941125 git log 101b27d..4941125 --no-merges --oneline 4941125 Revert "Compile embedder unit test Dart to kernel (#7227)" (flutter/engine#7230) f7d91d6 Roll src/third_party/skia 282ec5dc6ca7..2e6db18c4309 (1 commits) (flutter/engine#7228) ac9e521 Compile embedder unit test Dart to kernel (flutter/engine#7227) 828acc7 Roll src/third_party/skia d4962e7e07c0..282ec5dc6ca7 (1 commits) (flutter/engine#7226) 8a7ae95 Undeprecated BigInteger support, but document what it actually does. (flutter/engine#6903) 1778924 Offset.fromDirection and Size.aspectRatio (flutter/engine#6805) 9ae8217 Roll src/third_party/skia 8b78d70b9a10..d4962e7e07c0 (1 commits) (flutter/engine#7225) a987b17 Roll src/third_party/skia a1bded9a4f28..8b78d70b9a10 (1 commits) (flutter/engine#7224) ac05993 Roll src/third_party/skia 16d00eeef7d1..a1bded9a4f28 (2 commits) (flutter/engine#7223) 91bb1f8 Roll src/third_party/skia f391d0f771c6..16d00eeef7d1 (4 commits) (flutter/engine#7222) 6c40f84 [vulkan] Fix Fuchsia build 4f148ed Roll src/third_party/skia f6206f91b3c1..f391d0f771c6 (4 commits) (flutter/engine#7220) 1bc7ccf Support real fonts in 'flutter test' (flutter/engine#6913) 5244cf4 Roll src/third_party/skia 59c9f1595ecd..f6206f91b3c1 (1 commits) (flutter/engine#7219) 0f10d3f Roll src/third_party/skia 42e7a7ed6511..59c9f1595ecd (3 commits) (flutter/engine#7218) 1676421 Roll src/third_party/skia 21a7be0741ac..42e7a7ed6511 (1 commits) (flutter/engine#7217) 1a2714b Adds force cursor support (flutter/engine#6945) b50e349 Roll src/third_party/skia cb6b4bde0c2e..21a7be0741ac (3 commits) (flutter/engine#7216) 826f342 [Fuchsia] Depend on libtrace when that is what's really meant (flutter/engine#7214) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff ([email protected]), and stop the roller if necessary.
No description provided.