| 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 constructors: () => ({Circle: [Circle, [core.num, core.num, core.num]]}) |
| 60 }); |
| 58 class CirclePainter extends core.Object { | 61 class CirclePainter extends core.Object { |
| 59 CirclePainter() { | 62 CirclePainter() { |
| 60 this.color = ORANGE; | 63 this.color = ORANGE; |
| 61 } | 64 } |
| 62 draw() { | 65 draw() { |
| 63 exports.context.beginPath(); | 66 exports.context.beginPath(); |
| 64 exports.context.lineWidth = 2; | 67 exports.context.lineWidth = 2; |
| 65 exports.context.fillStyle = this.color; | 68 exports.context.fillStyle = this.color; |
| 66 exports.context.strokeStyle = this.color; | 69 exports.context.strokeStyle = this.color; |
| 67 exports.context.arc(this.x, this.y, this.radius, 0, TAU, false); | 70 exports.context.arc(this.x, this.y, this.radius, 0, TAU, false); |
| 68 exports.context.fill(); | 71 exports.context.fill(); |
| 69 exports.context.closePath(); | 72 exports.context.closePath(); |
| 70 exports.context.stroke(); | 73 exports.context.stroke(); |
| 71 } | 74 } |
| 72 } | 75 } |
| 73 CirclePainter[dart.implements] = () => [Circle]; | 76 CirclePainter[dart.implements] = () => [Circle]; |
| 74 dart.setSignature(CirclePainter, { | 77 dart.setSignature(CirclePainter, { |
| 75 methods: () => ({draw: [dart.void, []]}) | 78 methods: () => ({draw: [dart.void, []]}) |
| 76 }); | 79 }); |
| 77 class SunflowerSeed extends dart.mixin(Circle, CirclePainter) { | 80 class SunflowerSeed extends dart.mixin(Circle, CirclePainter) { |
| 78 SunflowerSeed(x, y, radius, color) { | 81 SunflowerSeed(x, y, radius, color) { |
| 79 if (color === void 0) | 82 if (color === void 0) |
| 80 color = null; | 83 color = null; |
| 81 super.Circle(x, y, radius); | 84 super.Circle(x, y, radius); |
| 82 if (color != null) | 85 if (color != null) |
| 83 this.color = color; | 86 this.color = color; |
| 84 } | 87 } |
| 85 } | 88 } |
| 89 dart.setSignature(SunflowerSeed, { |
| 90 constructors: () => ({SunflowerSeed: [SunflowerSeed, [core.num, core.num, co
re.num], [core.String]]}) |
| 91 }); |
| 86 // Exports: | 92 // Exports: |
| 87 exports.ORANGE = ORANGE; | 93 exports.ORANGE = ORANGE; |
| 88 exports.SEED_RADIUS = SEED_RADIUS; | 94 exports.SEED_RADIUS = SEED_RADIUS; |
| 89 exports.SCALE_FACTOR = SCALE_FACTOR; | 95 exports.SCALE_FACTOR = SCALE_FACTOR; |
| 90 exports.TAU = TAU; | 96 exports.TAU = TAU; |
| 91 exports.MAX_D = MAX_D; | 97 exports.MAX_D = MAX_D; |
| 92 exports.centerX = centerX; | 98 exports.centerX = centerX; |
| 93 exports.centerY = centerY; | 99 exports.centerY = centerY; |
| 94 exports.querySelector = querySelector; | 100 exports.querySelector = querySelector; |
| 95 exports.main = main; | 101 exports.main = main; |
| 96 exports.draw = draw; | 102 exports.draw = draw; |
| 97 exports.Circle = Circle; | 103 exports.Circle = Circle; |
| 98 exports.CirclePainter = CirclePainter; | 104 exports.CirclePainter = CirclePainter; |
| 99 exports.SunflowerSeed = SunflowerSeed; | 105 exports.SunflowerSeed = SunflowerSeed; |
| 100 })(sunflower, math, dom, core); | 106 })(sunflower, math, dom, core); |
| OLD | NEW |