OLD | NEW |
1 define(['dart_sdk'], function(dart_sdk) { | 1 define(['dart_sdk'], function(dart_sdk) { |
2 'use strict'; | 2 'use strict'; |
3 const core = dart_sdk.core; | 3 const core = dart_sdk.core; |
4 const html = dart_sdk.html; | 4 const html = dart_sdk.html; |
5 const math = dart_sdk.math; | 5 const math = dart_sdk.math; |
6 const dart = dart_sdk.dart; | 6 const dart = dart_sdk.dart; |
7 const dartx = dart_sdk.dartx; | 7 const dartx = dart_sdk.dartx; |
8 const sunflower = Object.create(null); | 8 const sunflower = Object.create(null); |
9 const circle = Object.create(null); | 9 const circle = Object.create(null); |
10 const painter = Object.create(null); | 10 const painter = Object.create(null); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 }; | 65 }; |
66 dart.fn(sunflower.draw, VoidTovoid()); | 66 dart.fn(sunflower.draw, VoidTovoid()); |
67 circle.Circle = class Circle extends core.Object { | 67 circle.Circle = class Circle extends core.Object { |
68 new(x, y, radius) { | 68 new(x, y, radius) { |
69 this.x = x; | 69 this.x = x; |
70 this.y = y; | 70 this.y = y; |
71 this.radius = radius; | 71 this.radius = radius; |
72 } | 72 } |
73 }; | 73 }; |
74 dart.setSignature(circle.Circle, { | 74 dart.setSignature(circle.Circle, { |
75 constructors: () => ({new: dart.definiteFunctionType(circle.Circle, [core.nu
m, core.num, core.num])}) | 75 constructors: () => ({new: dart.definiteFunctionType(circle.Circle, [core.nu
m, core.num, core.num])}), |
| 76 fields: () => ({ |
| 77 x: core.num, |
| 78 y: core.num, |
| 79 radius: core.num |
| 80 }) |
76 }); | 81 }); |
77 painter.CirclePainter = class CirclePainter extends core.Object { | 82 painter.CirclePainter = class CirclePainter extends core.Object { |
78 new() { | 83 new() { |
79 this.color = painter.ORANGE; | 84 this.color = painter.ORANGE; |
80 } | 85 } |
81 draw(context) { | 86 draw(context) { |
82 context[dartx.beginPath](); | 87 context[dartx.beginPath](); |
83 context[dartx.lineWidth] = 2; | 88 context[dartx.lineWidth] = 2; |
84 context[dartx.fillStyle] = this.color; | 89 context[dartx.fillStyle] = this.color; |
85 context[dartx.strokeStyle] = this.color; | 90 context[dartx.strokeStyle] = this.color; |
86 context[dartx.arc](this.x, this.y, this.radius, 0, painter.TAU, false); | 91 context[dartx.arc](this.x, this.y, this.radius, 0, painter.TAU, false); |
87 context[dartx.fill](); | 92 context[dartx.fill](); |
88 context[dartx.closePath](); | 93 context[dartx.closePath](); |
89 context[dartx.stroke](); | 94 context[dartx.stroke](); |
90 } | 95 } |
91 }; | 96 }; |
92 painter.CirclePainter[dart.implements] = () => [circle.Circle]; | 97 painter.CirclePainter[dart.implements] = () => [circle.Circle]; |
93 dart.setSignature(painter.CirclePainter, { | 98 dart.setSignature(painter.CirclePainter, { |
| 99 fields: () => ({color: core.String}), |
94 methods: () => ({draw: dart.definiteFunctionType(dart.void, [html.CanvasRend
eringContext2D])}) | 100 methods: () => ({draw: dart.definiteFunctionType(dart.void, [html.CanvasRend
eringContext2D])}) |
95 }); | 101 }); |
96 sunflower.SunflowerSeed = class SunflowerSeed extends dart.mixin(circle.Circle
, painter.CirclePainter) { | 102 sunflower.SunflowerSeed = class SunflowerSeed extends dart.mixin(circle.Circle
, painter.CirclePainter) { |
97 new(x, y, radius, color) { | 103 new(x, y, radius, color) { |
98 if (color === void 0) color = null; | 104 if (color === void 0) color = null; |
99 super.new(x, y, radius); | 105 super.new(x, y, radius); |
100 if (color != null) this.color = color; | 106 if (color != null) this.color = color; |
101 } | 107 } |
102 }; | 108 }; |
103 dart.setSignature(sunflower.SunflowerSeed, { | 109 dart.setSignature(sunflower.SunflowerSeed, { |
(...skipping 19 matching lines...) Expand all Loading... |
123 }); | 129 }); |
124 // Exports: | 130 // Exports: |
125 return { | 131 return { |
126 sunflower: sunflower, | 132 sunflower: sunflower, |
127 circle: circle, | 133 circle: circle, |
128 painter: painter | 134 painter: painter |
129 }; | 135 }; |
130 }); | 136 }); |
131 | 137 |
132 //# sourceMappingURL=sunflower.js.map | 138 //# sourceMappingURL=sunflower.js.map |
OLD | NEW |