Move Point to Offset (#9277)
* Manually fix every use of Point.x and Point.y
Some of these were moved to dx/dy, but not all.
* Manually convert uses of the old gradient API
* Remove old reference to Point.
* Mechanical changes
I applied the following at the root of the Flutter repository:
git ls-files -z | xargs -0 sed -i 's/\bPoint[.]origin\b/Offset.zero/g'
git ls-files -z | xargs -0 sed -i 's/\bPoint[.]lerp\b/Offset.lerp/g'
git ls-files -z | xargs -0 sed -i 's/\bnew Point\b/new Offset/g'
git ls-files -z | xargs -0 sed -i 's/\bconst Point\b/const Offset/g'
git ls-files -z | xargs -0 sed -i 's/\bstatic Point /static Offset /g'
git ls-files -z | xargs -0 sed -i 's/\bfinal Point /final Offset /g'
git ls-files -z | xargs -0 sed -i 's/^\( *\)Point /\1Offset /g'
git ls-files -z | xargs -0 sed -i 's/ui[.]Point\b/ui.Offset/g'
git ls-files -z | xargs -0 sed -i 's/(Point\b/(Offset/g'
git ls-files -z | xargs -0 sed -i 's/\([[{,]\) Point\b/\1 Offset/g'
git ls-files -z | xargs -0 sed -i 's/@required Point\b/@required Offset/g'
git ls-files -z | xargs -0 sed -i 's/<Point>/<Offset>/g'
git ls-files -z | xargs -0 sed -i 's/[.]toOffset()//g'
git ls-files -z | xargs -0 sed -i 's/[.]toPoint()//g'
git ls-files -z | xargs -0 sed -i 's/\bshow Point, /show /g'
git ls-files -z | xargs -0 sed -i 's/\bshow Point;/show Offset;/g'
* Mechanical changes - dartdocs
I applied the following at the root of the Flutter repository:
git ls-files -z | xargs -0 sed -i 's/\ba \[Point\]/an [Offset]/g'
git ls-files -z | xargs -0 sed -i 's/\[Point\]/[Offset]/g'
* Further improvements and a test
* Fix minor errors from rebasing...
* Roll engine
This commit is contained in:
@@ -525,22 +525,22 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
|
||||
if (child != null) {
|
||||
final Rect bounds = offset & size;
|
||||
// we move the offset to the center of the circle for the RenderSectors
|
||||
context.paintChild(child, bounds.center.toOffset());
|
||||
context.paintChild(child, bounds.center);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool hitTest(HitTestResult result, { Point position }) {
|
||||
bool hitTest(HitTestResult result, { Offset position }) {
|
||||
if (child == null)
|
||||
return false;
|
||||
double x = position.x;
|
||||
double y = position.y;
|
||||
double x = position.dx;
|
||||
double y = position.dy;
|
||||
// translate to our origin
|
||||
x -= size.width/2.0;
|
||||
y -= size.height/2.0;
|
||||
x -= size.width / 2.0;
|
||||
y -= size.height / 2.0;
|
||||
// convert to radius/theta
|
||||
final double radius = math.sqrt(x*x+y*y);
|
||||
final double theta = (math.atan2(x, -y) - math.PI/2.0) % kTwoPi;
|
||||
final double radius = math.sqrt(x * x + y * y);
|
||||
final double theta = (math.atan2(x, -y) - math.PI / 2.0) % kTwoPi;
|
||||
if (radius < innerRadius)
|
||||
return false;
|
||||
if (radius >= innerRadius + child.deltaRadius)
|
||||
|
||||
@@ -23,7 +23,7 @@ class Dot {
|
||||
Dot({ Color color }) : _paint = new Paint()..color = color;
|
||||
|
||||
final Paint _paint;
|
||||
Point position = Point.origin;
|
||||
Offset position = Offset.zero;
|
||||
double radius = 0.0;
|
||||
|
||||
void update(PointerEvent event) {
|
||||
@@ -58,7 +58,7 @@ class RenderDots extends RenderBox {
|
||||
|
||||
/// Makes this render object hittable so that it receives pointer events.
|
||||
@override
|
||||
bool hitTestSelf(Point position) => true;
|
||||
bool hitTestSelf(Offset position) => true;
|
||||
|
||||
/// Processes pointer events by mutating state and invalidating its previous
|
||||
/// painting commands.
|
||||
|
||||
Reference in New Issue
Block a user