Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: sky/examples/raw/sector-layout.dart

Issue 1165463002: Make RenderParagraph mutable, and make it fit the new RenderNode protocols (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: git rebase -i Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/examples/raw/render_paragraph.dart ('k') | sky/examples/raw/simple_render_tree.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'package:sky/framework/app.dart'; 7 import 'package:sky/framework/app.dart';
8 import 'package:sky/framework/layout2.dart'; 8 import 'package:sky/framework/layout2.dart';
9 9
10 const double kTwoPi = 2 * math.PI; 10 const double kTwoPi = 2 * math.PI;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 double dimension = (innerRadius + childDimensions.deltaRadius) * 2.0; 409 double dimension = (innerRadius + childDimensions.deltaRadius) * 2.0;
410 return constraints.constrain(new sky.Size(dimension, dimension)); 410 return constraints.constrain(new sky.Size(dimension, dimension));
411 } 411 }
412 412
413 void performLayout() { 413 void performLayout() {
414 if (child == null) { 414 if (child == null) {
415 size = constraints.constrain(new sky.Size(0.0, 0.0)); 415 size = constraints.constrain(new sky.Size(0.0, 0.0));
416 } else { 416 } else {
417 assert(child is RenderSector); 417 assert(child is RenderSector);
418 assert(!constraints.isInfinite); 418 assert(!constraints.isInfinite);
419 print("constraint maxes: ${constraints.maxWidth} and ${constraints.maxHeig ht}");
419 double maxChildDeltaRadius = math.min(constraints.maxWidth, constraints.ma xHeight) / 2.0 - innerRadius; 420 double maxChildDeltaRadius = math.min(constraints.maxWidth, constraints.ma xHeight) / 2.0 - innerRadius;
421 print("maxChildDeltaRadius = $maxChildDeltaRadius");
420 assert(child.parentData is SectorParentData); 422 assert(child.parentData is SectorParentData);
421 child.parentData.radius = innerRadius; 423 child.parentData.radius = innerRadius;
422 child.parentData.theta = 0.0; 424 child.parentData.theta = 0.0;
423 child.layout(new SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), p arentUsesSize: true); 425 child.layout(new SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), p arentUsesSize: true);
424 double dimension = (innerRadius + child.deltaRadius) * 2.0; 426 double dimension = (innerRadius + child.deltaRadius) * 2.0;
425 size = constraints.constrain(new sky.Size(dimension, dimension)); 427 size = constraints.constrain(new sky.Size(dimension, dimension));
426 } 428 }
427 } 429 }
428 430
429 // paint origin is 0,0 of our circle 431 // paint origin is 0,0 of our circle
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 rootCircle.add(new RenderSolidColor(0xFF0000FF, desiredDeltaTheta: kTwoPi * 0. 4)); 498 rootCircle.add(new RenderSolidColor(0xFF0000FF, desiredDeltaTheta: kTwoPi * 0. 4));
497 var stack = new RenderSectorSlice(padding: 2.0); 499 var stack = new RenderSectorSlice(padding: 2.0);
498 stack.add(new RenderSolidColor(0xFFFFFF00, desiredDeltaRadius: 20.0)); 500 stack.add(new RenderSolidColor(0xFFFFFF00, desiredDeltaRadius: 20.0));
499 stack.add(new RenderSolidColor(0xFFFF9000, desiredDeltaRadius: 20.0)); 501 stack.add(new RenderSolidColor(0xFFFF9000, desiredDeltaRadius: 20.0));
500 stack.add(new RenderSolidColor(0xFF00FF00)); 502 stack.add(new RenderSolidColor(0xFF00FF00));
501 rootCircle.add(stack); 503 rootCircle.add(stack);
502 504
503 var root = new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCi rcle); 505 var root = new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCi rcle);
504 app = new AppView(root); 506 app = new AppView(root);
505 } 507 }
OLDNEW
« no previous file with comments | « sky/examples/raw/render_paragraph.dart ('k') | sky/examples/raw/simple_render_tree.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698