Chromium Code Reviews| Index: client/touch/Geometry.dart |
| diff --git a/client/touch/Geometry.dart b/client/touch/Geometry.dart |
| index c406f11136a25622f57ad063971b2844cb40db01..100b547b51d8a95976bc13a66d2cacade0bedf43 100644 |
| --- a/client/touch/Geometry.dart |
| +++ b/client/touch/Geometry.dart |
| @@ -53,152 +53,9 @@ class Coordinate { |
| /** |
| * Returns a new copy of the coordinate. |
| */ |
| - Coordinate clone() { |
| - return new Coordinate(x, y); |
| - } |
| - |
| - /** |
| - * Returns a nice string representing the coordinate. |
| - * @return {string} In the form (50, 73). |
| - */ |
| - String toString() { |
| - return "(${x}, ${y})"; |
| - } |
| -} |
| - |
| -/** |
| - * A utility class for representing two-dimensional sizes. |
| - */ |
| -class Size { |
| - num width; |
| - num height; |
| - |
| - Size(num this.width, num this.height) { |
| - } |
| - |
| - bool operator ==(Size other) { |
| - return other !== null && width == other.width && height == other.height; |
| - } |
| - |
| - /** |
| - * Returns the area of the size (width * height). |
| - */ |
| - num area() { |
| - return width * height; |
| - } |
| - |
| - /** |
| - * Returns the ratio of the size's width to its height. |
| - */ |
| - num aspectRatio() { |
| - return width / height; |
| - } |
| - |
| - /** |
| - * Clamps the width and height parameters upward to integer values. |
| - * Returns this size with ceil'd components. |
| - */ |
| - Size ceil() { |
| - width = width.ceil(); |
| - height = height.ceil(); |
| - return this; |
| - } |
| - |
| - /** |
| - * Returns a new copy of the Size. |
| - */ |
| - Size clone() { |
| - return new Size(width, height); |
| - } |
| - |
| - /** |
| - * Returns true if this Size is the same size or smaller than the |
| - * [target] size in both dimensions. |
| - */ |
| - bool fitsInside(Size target) { |
| - return width <= target.width && height <= target.height; |
| - } |
| - |
| - /** |
| - * Clamps the width and height parameters downward to integer values. |
| - * Returns this size with floored components. |
| - */ |
| - Size floor() { |
| - width = width.floor(); |
| - height = height.floor(); |
| - return this; |
| - } |
| - |
| - /** |
| - * Returns the longer of the two dimensions in the size. |
| - */ |
| - num getLongest() { |
| - return Math.max(width, height); |
| - } |
| - |
| - /** |
| - * Returns the shorter of the two dimensions in the size. |
| - */ |
| - num getShortest() { |
| - return Math.min(width, height); |
| - } |
| + Coordinate clone() => new Coordinate(x, y); |
| - /** |
| - * Returns true if the size has zero area, false if both dimensions |
| - * are non-zero numbers. |
| - */ |
| - bool isEmpty() { |
| - return area() == 0; |
| - } |
| - |
| - /** |
| - * Returns the perimeter of the size (width + height) * 2. |
| - */ |
| - num perimeter() { |
| - return (width + height) * 2; |
| - } |
| - |
| - /** |
| - * Rounds the width and height parameters to integer values. |
| - * Returns this size with rounded components. |
| - */ |
| - Size round() { |
| - width = width.round(); |
| - height = height.round(); |
| - return this; |
| - } |
| - |
| - /** |
| - * Scales the size uniformly by a factor. |
| - * [s] The scale factor. |
| - * Returns this Size object after scaling. |
| - */ |
| - Size scale(num s) { |
| - width *= s; |
| - height *= s; |
| - return this; |
| - } |
| - |
| - /** |
| - * Uniformly scales the size to fit inside the dimensions of a given size. The |
| - * original aspect ratio will be preserved. |
| - * |
| - * This function assumes that both Sizes contain strictly positive dimensions. |
| - * Returns this Size object, after optional scaling. |
| - */ |
| - Size scaleToFit(Size target) { |
| - num s = aspectRatio() > target.aspectRatio() ? |
| - target.width / width : target.height / height; |
| - return scale(s); |
| - } |
| - |
| - /** |
| - * Returns a nice string representing size. |
| - * Returns in the form (50 x 73). |
| - */ |
| - String toString() { |
| - return "(${width} x ${height})"; |
| - } |
| + String toString() => "($x, $y)"; |
|
nweiz
2011/10/28 03:58:38
Class name?
Jacob
2011/10/31 22:09:50
We intentionally avoid the class name.
If you wro
|
| } |
| /** |