| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void setParentData(RenderObject child) { | 68 void setParentData(RenderObject child) { |
| 69 if (child.parentData is! SectorParentData) | 69 if (child.parentData is! SectorParentData) |
| 70 child.parentData = new SectorParentData(); | 70 child.parentData = new SectorParentData(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double
radius) { | 73 SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double
radius) { |
| 74 return new SectorDimensions.withConstraints(constraints); | 74 return new SectorDimensions.withConstraints(constraints); |
| 75 } | 75 } |
| 76 | 76 |
| 77 SectorConstraints get constraints => super.constraints; | 77 SectorConstraints get constraints => super.constraints; |
| 78 bool debugDoesMeetConstraints() { |
| 79 assert(constraints != null); |
| 80 assert(deltaRadius != null); |
| 81 assert(deltaRadius < double.INFINITY); |
| 82 assert(deltaTheta != null); |
| 83 assert(deltaTheta < double.INFINITY); |
| 84 return constraints.minDeltaRadius <= deltaRadius && |
| 85 deltaRadius <= math.max(constraints.minDeltaRadius, constraints.maxDe
ltaRadius) && |
| 86 constraints.minDeltaTheta <= deltaTheta && |
| 87 deltaTheta <= math.max(constraints.minDeltaTheta, constraints.maxDelt
aTheta); |
| 88 } |
| 78 void performResize() { | 89 void performResize() { |
| 79 // default behaviour for subclasses that have sizedByParent = true | 90 // default behaviour for subclasses that have sizedByParent = true |
| 80 deltaRadius = constraints.constrainDeltaRadius(0.0); | 91 deltaRadius = constraints.constrainDeltaRadius(0.0); |
| 81 deltaTheta = constraints.constrainDeltaTheta(0.0); | 92 deltaTheta = constraints.constrainDeltaTheta(0.0); |
| 82 } | 93 } |
| 83 void performLayout() { | 94 void performLayout() { |
| 84 // descendants have to either override performLayout() to set both | 95 // descendants have to either override performLayout() to set both |
| 85 // the dimensions and lay out children, or, set sizedByParent to | 96 // the dimensions and lay out children, or, set sizedByParent to |
| 86 // true so that performResize()'s logic above does its thing. | 97 // true so that performResize()'s logic above does its thing. |
| 87 assert(sizedByParent); | 98 assert(sizedByParent); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 stack.add(new RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20
.0)); | 531 stack.add(new RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20
.0)); |
| 521 stack.add(new RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20
.0)); | 532 stack.add(new RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20
.0)); |
| 522 stack.add(new RenderSolidColor(const Color(0xFF00FF00))); | 533 stack.add(new RenderSolidColor(const Color(0xFF00FF00))); |
| 523 rootCircle.add(stack); | 534 rootCircle.add(stack); |
| 524 return new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCircle
); | 535 return new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCircle
); |
| 525 } | 536 } |
| 526 | 537 |
| 527 void main() { | 538 void main() { |
| 528 new SkyBinding(root: buildSectorExample()); | 539 new SkyBinding(root: buildSectorExample()); |
| 529 } | 540 } |
| OLD | NEW |