| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
| 6 * Represents a point in 2 dimensional space. | 6 * Represents a point in 2 dimensional space. |
| 7 */ | 7 */ |
| 8 class Coordinate { | 8 class Coordinate { |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * X-value | 11 * X-value |
| 12 */ | 12 */ |
| 13 num x; | 13 num x; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Y-value | 16 * Y-value |
| 17 */ | 17 */ |
| 18 num y; | 18 num y; |
| 19 | 19 |
| 20 Coordinate([num x = 0, num y = 0]) : this.x = x, this.y = y { | 20 Coordinate([num this.x = 0, num this.y = 0]) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Gets the coordinates of a touch's location relative to the window's | 24 * Gets the coordinates of a touch's location relative to the window's |
| 25 * viewport. [input] is either a touch object or an event object. | 25 * viewport. [input] is either a touch object or an event object. |
| 26 */ | 26 */ |
| 27 Coordinate.fromClient(var input) : this(input.clientX, input.clientY); | 27 Coordinate.fromClient(var input) : this(input.clientX, input.clientY); |
| 28 | 28 |
| 29 static Coordinate difference(Coordinate a, Coordinate b) { | 29 static Coordinate difference(Coordinate a, Coordinate b) { |
| 30 return new Coordinate(a.x - b.x, a.y - b.y); | 30 return new Coordinate(a.x - b.x, a.y - b.y); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool contains(num value) { | 84 bool contains(num value) { |
| 85 return value >= start && value < end; | 85 return value >= start && value < end; |
| 86 } | 86 } |
| 87 | 87 |
| 88 String toString() { | 88 String toString() { |
| 89 return '(${start}, ${end})'; | 89 return '(${start}, ${end})'; |
| 90 } | 90 } |
| 91 } | 91 } |
| OLD | NEW |