| OLD | NEW |
| 1 var sunflower = dart.defineLibrary(sunflower, {}); | 1 var sunflower = dart.defineLibrary(sunflower, {}); |
| 2 var math = dart.import(math); | 2 var math = dart.import(math); |
| 3 var dom = dart.import(dom); | 3 var dom = dart.import(dom); |
| 4 var core = dart.import(core); | 4 var core = dart.import(core); |
| 5 (function(exports, math, dom, core) { | 5 (function(exports, math, dom, core) { |
| 6 'use strict'; | 6 'use strict'; |
| 7 let ORANGE = "orange"; | 7 let ORANGE = "orange"; |
| 8 let SEED_RADIUS = 2; | 8 let SEED_RADIUS = 2; |
| 9 let SCALE_FACTOR = 4; | 9 let SCALE_FACTOR = 4; |
| 10 let TAU = dart.notNull(math.PI) * 2; | 10 let TAU = dart.notNull(math.PI) * 2; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 exports.notes.textContent = `${exports.seeds} seeds`; | 48 exports.notes.textContent = `${exports.seeds} seeds`; |
| 49 } | 49 } |
| 50 dart.fn(draw, dart.void, []); | 50 dart.fn(draw, dart.void, []); |
| 51 class Circle extends core.Object { | 51 class Circle extends core.Object { |
| 52 Circle(x, y, radius) { | 52 Circle(x, y, radius) { |
| 53 this.x = x; | 53 this.x = x; |
| 54 this.y = y; | 54 this.y = y; |
| 55 this.radius = radius; | 55 this.radius = radius; |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 dart.setSignature(Circle, {}); | |
| 59 class CirclePainter extends core.Object { | 58 class CirclePainter extends core.Object { |
| 60 CirclePainter() { | 59 CirclePainter() { |
| 61 this.color = ORANGE; | 60 this.color = ORANGE; |
| 62 } | 61 } |
| 63 draw() { | 62 draw() { |
| 64 exports.context.beginPath(); | 63 exports.context.beginPath(); |
| 65 exports.context.lineWidth = 2; | 64 exports.context.lineWidth = 2; |
| 66 exports.context.fillStyle = this.color; | 65 exports.context.fillStyle = this.color; |
| 67 exports.context.strokeStyle = this.color; | 66 exports.context.strokeStyle = this.color; |
| 68 exports.context.arc(this.x, this.y, this.radius, 0, TAU, false); | 67 exports.context.arc(this.x, this.y, this.radius, 0, TAU, false); |
| 69 exports.context.fill(); | 68 exports.context.fill(); |
| 70 exports.context.closePath(); | 69 exports.context.closePath(); |
| 71 exports.context.stroke(); | 70 exports.context.stroke(); |
| 72 } | 71 } |
| 73 } | 72 } |
| 74 CirclePainter[dart.implements] = () => [Circle]; | 73 CirclePainter[dart.implements] = () => [Circle]; |
| 75 dart.setSignature(CirclePainter, { | 74 dart.setSignature(CirclePainter, { |
| 76 methods: () => ({draw: dart.functionType(dart.void, [])}) | 75 methods: () => ({draw: dart.functionType(dart.void, [])}) |
| 77 }); | 76 }); |
| 78 class SunflowerSeed extends dart.mixin(Circle, CirclePainter) { | 77 class SunflowerSeed extends dart.mixin(Circle, CirclePainter) { |
| 79 SunflowerSeed(x, y, radius, color) { | 78 SunflowerSeed(x, y, radius, color) { |
| 80 if (color === void 0) | 79 if (color === void 0) |
| 81 color = null; | 80 color = null; |
| 82 super.Circle(x, y, radius); | 81 super.Circle(x, y, radius); |
| 83 if (color != null) | 82 if (color != null) |
| 84 this.color = color; | 83 this.color = color; |
| 85 } | 84 } |
| 86 } | 85 } |
| 87 dart.setSignature(SunflowerSeed, {}); | |
| 88 // Exports: | 86 // Exports: |
| 89 exports.ORANGE = ORANGE; | 87 exports.ORANGE = ORANGE; |
| 90 exports.SEED_RADIUS = SEED_RADIUS; | 88 exports.SEED_RADIUS = SEED_RADIUS; |
| 91 exports.SCALE_FACTOR = SCALE_FACTOR; | 89 exports.SCALE_FACTOR = SCALE_FACTOR; |
| 92 exports.TAU = TAU; | 90 exports.TAU = TAU; |
| 93 exports.MAX_D = MAX_D; | 91 exports.MAX_D = MAX_D; |
| 94 exports.centerX = centerX; | 92 exports.centerX = centerX; |
| 95 exports.centerY = centerY; | 93 exports.centerY = centerY; |
| 96 exports.querySelector = querySelector; | 94 exports.querySelector = querySelector; |
| 97 exports.main = main; | 95 exports.main = main; |
| 98 exports.draw = draw; | 96 exports.draw = draw; |
| 99 exports.Circle = Circle; | 97 exports.Circle = Circle; |
| 100 exports.CirclePainter = CirclePainter; | 98 exports.CirclePainter = CirclePainter; |
| 101 exports.SunflowerSeed = SunflowerSeed; | 99 exports.SunflowerSeed = SunflowerSeed; |
| 102 })(sunflower, math, dom, core); | 100 })(sunflower, math, dom, core); |
| OLD | NEW |