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])}), | |
76 fields: () => ({ | 75 fields: () => ({ |
77 x: core.num, | 76 x: core.num, |
78 y: core.num, | 77 y: core.num, |
79 radius: core.num | 78 radius: core.num |
80 }) | 79 }) |
81 }); | 80 }); |
82 painter.CirclePainter = class CirclePainter extends core.Object { | 81 painter.CirclePainter = class CirclePainter extends core.Object { |
83 new() { | 82 new() { |
84 this.color = painter.ORANGE; | 83 this.color = painter.ORANGE; |
85 } | 84 } |
(...skipping 13 matching lines...) Expand all Loading... |
99 fields: () => ({color: core.String}), | 98 fields: () => ({color: core.String}), |
100 methods: () => ({draw: dart.definiteFunctionType(dart.void, [html.CanvasRend
eringContext2D])}) | 99 methods: () => ({draw: dart.definiteFunctionType(dart.void, [html.CanvasRend
eringContext2D])}) |
101 }); | 100 }); |
102 sunflower.SunflowerSeed = class SunflowerSeed extends dart.mixin(circle.Circle
, painter.CirclePainter) { | 101 sunflower.SunflowerSeed = class SunflowerSeed extends dart.mixin(circle.Circle
, painter.CirclePainter) { |
103 new(x, y, radius, color) { | 102 new(x, y, radius, color) { |
104 if (color === void 0) color = null; | 103 if (color === void 0) color = null; |
105 super.new(x, y, radius); | 104 super.new(x, y, radius); |
106 if (color != null) this.color = color; | 105 if (color != null) this.color = color; |
107 } | 106 } |
108 }; | 107 }; |
109 dart.setSignature(sunflower.SunflowerSeed, { | |
110 constructors: () => ({new: dart.definiteFunctionType(sunflower.SunflowerSeed
, [core.num, core.num, core.num], [core.String])}) | |
111 }); | |
112 painter.ORANGE = "orange"; | 108 painter.ORANGE = "orange"; |
113 painter.RED = "red"; | 109 painter.RED = "red"; |
114 painter.BLUE = "blue"; | 110 painter.BLUE = "blue"; |
115 painter.TAU = math.PI * 2; | 111 painter.TAU = math.PI * 2; |
116 painter.querySelector = function(selector) { | 112 painter.querySelector = function(selector) { |
117 return html.document[dartx.querySelector](selector); | 113 return html.document[dartx.querySelector](selector); |
118 }; | 114 }; |
119 dart.fn(painter.querySelector, StringToElement()); | 115 dart.fn(painter.querySelector, StringToElement()); |
120 dart.defineLazy(painter, { | 116 dart.defineLazy(painter, { |
121 get canvas() { | 117 get canvas() { |
122 return html.CanvasElement.as(painter.querySelector("#canvas")); | 118 return html.CanvasElement.as(painter.querySelector("#canvas")); |
123 } | 119 } |
124 }); | 120 }); |
125 dart.defineLazy(painter, { | 121 dart.defineLazy(painter, { |
126 get context() { | 122 get context() { |
127 return html.CanvasRenderingContext2D.as(painter.canvas[dartx.getContext]('
2d')); | 123 return html.CanvasRenderingContext2D.as(painter.canvas[dartx.getContext]('
2d')); |
128 } | 124 } |
129 }); | 125 }); |
130 // Exports: | 126 // Exports: |
131 return { | 127 return { |
132 sunflower: sunflower, | 128 sunflower: sunflower, |
133 circle: circle, | 129 circle: circle, |
134 painter: painter | 130 painter: painter |
135 }; | 131 }; |
136 }); | 132 }); |
137 | 133 |
138 //# sourceMappingURL=sunflower.js.map | 134 //# sourceMappingURL=sunflower.js.map |
OLD | NEW |