Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 | 7 |
| 8 import 'package:sky/rendering/box.dart'; | 8 import 'package:sky/rendering/box.dart'; |
| 9 import 'package:sky/rendering/object.dart'; | 9 import 'package:sky/rendering/object.dart'; |
| 10 import 'package:sky/rendering/sky_binding.dart'; | 10 import 'package:sky/rendering/sky_binding.dart'; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 deltaRadius = constraints.constrainDeltaRadius(0.0); | 91 deltaRadius = constraints.constrainDeltaRadius(0.0); |
| 92 deltaTheta = constraints.constrainDeltaTheta(0.0); | 92 deltaTheta = constraints.constrainDeltaTheta(0.0); |
| 93 } | 93 } |
| 94 void performLayout() { | 94 void performLayout() { |
| 95 // descendants have to either override performLayout() to set both | 95 // descendants have to either override performLayout() to set both |
| 96 // the dimensions and lay out children, or, set sizedByParent to | 96 // the dimensions and lay out children, or, set sizedByParent to |
| 97 // true so that performResize()'s logic above does its thing. | 97 // true so that performResize()'s logic above does its thing. |
| 98 assert(sizedByParent); | 98 assert(sizedByParent); |
| 99 } | 99 } |
| 100 | 100 |
| 101 Rect get paintBounds => new Rect.fromLTWH(0.0, 0.0, 2.0 * deltaRadius, 2.0 * d eltaRadius); | |
|
Hixie
2015/07/10 18:01:01
this seems wrong. the origin is on the middle of t
abarth-chromium
2015/07/10 18:09:30
Ok. Currently it's not used by anything because n
| |
| 102 | |
| 101 bool hitTest(HitTestResult result, { double radius, double theta }) { | 103 bool hitTest(HitTestResult result, { double radius, double theta }) { |
| 102 assert(parentData is SectorParentData); | 104 assert(parentData is SectorParentData); |
| 103 if (radius < parentData.radius || radius >= parentData.radius + deltaRadius || | 105 if (radius < parentData.radius || radius >= parentData.radius + deltaRadius || |
| 104 theta < parentData.theta || theta >= parentData.theta + deltaTheta) | 106 theta < parentData.theta || theta >= parentData.theta + deltaTheta) |
| 105 return false; | 107 return false; |
| 106 hitTestChildren(result, radius: radius, theta: theta); | 108 hitTestChildren(result, radius: radius, theta: theta); |
| 107 result.add(new HitTestEntry(this)); | 109 result.add(new HitTestEntry(this)); |
| 108 return true; | 110 return true; |
| 109 } | 111 } |
| 110 void hitTestChildren(HitTestResult result, { double radius, double theta }) { } | 112 void hitTestChildren(HitTestResult result, { double radius, double theta }) { } |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 if (radius < innerRadius) | 487 if (radius < innerRadius) |
| 486 return false; | 488 return false; |
| 487 if (radius >= innerRadius + child.deltaRadius) | 489 if (radius >= innerRadius + child.deltaRadius) |
| 488 return false; | 490 return false; |
| 489 if (theta > child.deltaTheta) | 491 if (theta > child.deltaTheta) |
| 490 return false; | 492 return false; |
| 491 child.hitTest(result, radius: radius, theta: theta); | 493 child.hitTest(result, radius: radius, theta: theta); |
| 492 result.add(new BoxHitTestEntry(this, position)); | 494 result.add(new BoxHitTestEntry(this, position)); |
| 493 return true; | 495 return true; |
| 494 } | 496 } |
| 495 | 497 |
| 496 } | 498 } |
| 497 | 499 |
| 498 class RenderSolidColor extends RenderDecoratedSector { | 500 class RenderSolidColor extends RenderDecoratedSector { |
| 499 RenderSolidColor(Color backgroundColor, { | 501 RenderSolidColor(Color backgroundColor, { |
| 500 this.desiredDeltaRadius: double.INFINITY, | 502 this.desiredDeltaRadius: double.INFINITY, |
| 501 this.desiredDeltaTheta: kTwoPi | 503 this.desiredDeltaTheta: kTwoPi |
| 502 }) : this.backgroundColor = backgroundColor, | 504 }) : this.backgroundColor = backgroundColor, |
| 503 super(new BoxDecoration(backgroundColor: backgroundColor)); | 505 super(new BoxDecoration(backgroundColor: backgroundColor)); |
| 504 | 506 |
| 505 double desiredDeltaRadius; | 507 double desiredDeltaRadius; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 531 stack.add(new RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20 .0)); | 533 stack.add(new RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20 .0)); |
| 532 stack.add(new RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20 .0)); | 534 stack.add(new RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20 .0)); |
| 533 stack.add(new RenderSolidColor(const Color(0xFF00FF00))); | 535 stack.add(new RenderSolidColor(const Color(0xFF00FF00))); |
| 534 rootCircle.add(stack); | 536 rootCircle.add(stack); |
| 535 return new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCircle ); | 537 return new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCircle ); |
| 536 } | 538 } |
| 537 | 539 |
| 538 void main() { | 540 void main() { |
| 539 new SkyBinding(root: buildSectorExample()); | 541 new SkyBinding(root: buildSectorExample()); |
| 540 } | 542 } |
| OLD | NEW |