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

Unified Diff: test/codegen/sunflower/sunflower.dart

Issue 1147053003: Modified sunflower (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebased Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« test/codegen/sunflower/painter.dart ('K') | « test/codegen/sunflower/painter.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/sunflower/sunflower.dart
diff --git a/test/codegen/sunflower/sunflower.dart b/test/codegen/sunflower/sunflower.dart
index bf140b188d51e00df6a56064bd27ebf2e6a9cb0a..e60bbf7fe0977f63e4b887c01df83ee16b42dafe 100644
--- a/test/codegen/sunflower/sunflower.dart
+++ b/test/codegen/sunflower/sunflower.dart
@@ -5,24 +5,21 @@
library sunflower;
import 'dart:math';
+
+import 'circle.dart';
import 'dom.dart';
+import 'painter.dart';
-const ORANGE = "orange";
const SEED_RADIUS = 2;
const SCALE_FACTOR = 4;
-const TAU = PI * 2;
const MAX_D = 300;
const centerX = MAX_D / 2;
const centerY = centerX;
-Element querySelector(String selector) => document.querySelector(selector);
-
-final InputElement slider = querySelector("#slider");
+final slider = querySelector("#slider") as InputElement;
final notes = querySelector("#notes");
final PHI = (sqrt(5) + 1) / 2;
int seeds = 0;
-final CanvasRenderingContext2D context =
- (querySelector("#canvas") as CanvasElement).getContext('2d');
void main() {
slider.addEventListener('change', (e) => draw());
@@ -51,26 +48,4 @@ class SunflowerSeed extends Circle with CirclePainter {
}
}
-abstract class CirclePainter implements Circle {
- // This demonstrates a field in a mixin.
- String color = ORANGE;
- /// Draw a small circle representing a seed centered at (x,y).
- void draw() {
- context
- ..beginPath()
- ..lineWidth = 2
- ..fillStyle = color
- ..strokeStyle = color
- ..arc(x, y, radius, 0, TAU, false)
- ..fill()
- ..closePath()
- ..stroke();
- }
-}
-
-class Circle {
- final num x, y, radius;
-
- Circle(this.x, this.y, this.radius);
-}
« test/codegen/sunflower/painter.dart ('K') | « test/codegen/sunflower/painter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698