Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@Hixie
Copy link
Contributor

@Hixie Hixie commented Nov 8, 2018

No description provided.

@Hixie
Copy link
Contributor Author

Hixie commented Nov 8, 2018

Completely untested code right now. :-)

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));
Copy link
Contributor

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.

Copy link
Contributor Author

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.

///
/// 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));
Copy link
Contributor

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?

Copy link
Contributor Author

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.

/// 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;
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, fixed.

@Hixie Hixie changed the title Offset.fromDirection and Size.aspectRatio [H] Offset.fromDirection and Size.aspectRatio Nov 12, 2018
@Hixie Hixie changed the title [H] Offset.fromDirection and Size.aspectRatio [O] Offset.fromDirection and Size.aspectRatio Nov 12, 2018
@Hixie
Copy link
Contributor Author

Hixie commented Nov 15, 2018

Ok, this time it's actually been tested.

Copy link
Contributor

@jamesderlin jamesderlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@slightfoot
Copy link
Member

@Hixie thanks 👍

@Hixie Hixie changed the title [O] Offset.fromDirection and Size.aspectRatio [OR] Offset.fromDirection and Size.aspectRatio Nov 20, 2018
@Hixie
Copy link
Contributor Author

Hixie commented Dec 14, 2018

Rebased and kicked bots, will land on green.

@Hixie Hixie merged commit 1778924 into flutter:master Dec 15, 2018
@Hixie Hixie deleted the vectors branch December 15, 2018 16:32
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 15, 2018
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 15, 2018
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 16, 2018
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Dec 16, 2018
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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants