Chromium Code Reviews| Index: sky/engine/core/painting/Offset.dart |
| diff --git a/sky/engine/core/painting/Offset.dart b/sky/engine/core/painting/Offset.dart |
| index 161bd754c5ca2637d09219f4bb6eea5fb4ab1cf9..13e458882e9090e44dc9bf333112a41da45cc599 100644 |
| --- a/sky/engine/core/painting/Offset.dart |
| +++ b/sky/engine/core/painting/Offset.dart |
| @@ -20,7 +20,13 @@ class Offset extends OffsetBase { |
| Offset operator -() => new Offset(-dx, -dy); |
| Offset operator -(Offset other) => new Offset(dx - other.dx, dy - other.dy); |
| - Offset operator +(Offset other) => new Offset(dx + other.dx, dy + other.dy); |
| + dynamic operator +(dynamic other) { |
| + if (other is Offset) |
| + return new Offset(dx + other.dx, dy + other.dy); |
| + if (other is Size) |
| + return new Rect.fromLTWH(dx, dy, other.width, other.height); |
|
abarth-chromium
2015/06/27 00:39:37
Wow, an offset + a size is a rect? Crazy.
|
| + throw new ArgumentError(other); |
| + } |
| // does the equivalent of "return new Point(0,0) + this" |
| Point toPoint() => new Point(this.dx, this.dy); |