| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 8 $!MEMBERS | 8 $!MEMBERS |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 '#.lineDashOffset || #.webkitLineDashOffset', this, this); | 258 '#.lineDashOffset || #.webkitLineDashOffset', this, this); |
| 259 | 259 |
| 260 @DomName('CanvasRenderingContext2D.lineDashOffset') | 260 @DomName('CanvasRenderingContext2D.lineDashOffset') |
| 261 void set lineDashOffset(num value) => JS('void', | 261 void set lineDashOffset(num value) => JS('void', |
| 262 'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : ' | 262 'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : ' |
| 263 '#.webkitLineDashOffset = #', this, this, value, this, value); | 263 '#.webkitLineDashOffset = #', this, this, value, this, value); |
| 264 $else | 264 $else |
| 265 // TODO(amouravski): Add Dartium native methods for drawImage once we figure | 265 // TODO(amouravski): Add Dartium native methods for drawImage once we figure |
| 266 // out how to not break native bindings. | 266 // out how to not break native bindings. |
| 267 $endif | 267 $endif |
| 268 |
| 269 $if DART2JS |
| 270 /** |
| 271 * Draws text to the canvas. |
| 272 * |
| 273 * The text is drawn starting at coordinates ([x], [y]). |
| 274 * If [maxWidth] is provided and the [text] is computed to be wider than |
| 275 * [maxWidth], then the drawn text is scaled down horizontally to fit. |
| 276 * |
| 277 * The text uses the current [CanvasRenderingContext2D.font] property for font |
| 278 * options, such as typeface and size, and the current |
| 279 * [CanvasRenderingContext2D.fillStyle] for style options such as color. |
| 280 * The current [CanvasRenderingContext2D.textAlign] and |
| 281 * [CanvasRenderingContext2D.textBaseLine] properties are also applied to the |
| 282 * drawn text. |
| 283 */ |
| 284 @DomName('CanvasRenderingContext2D.fillText') |
| 285 void fillText(String text, num x, num y, [num maxWidth]) { |
| 286 if (maxWidth != null) { |
| 287 JS('void', '#.fillText(#, #, #, #)', this, text, x, y, maxWidth); |
| 288 } else { |
| 289 JS('void', '#.fillText(#, #, #)', this, text, x, y); |
| 290 } |
| 291 } |
| 292 $endif |
| 268 } | 293 } |
| 269 | |
| OLD | NEW |