| 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);
|
| -}
|
|
|