| Index: third_party/google_input_tools/third_party/closure_library/closure/goog/math/size.js
|
| diff --git a/third_party/google_input_tools/third_party/closure_library/closure/goog/math/size.js b/third_party/google_input_tools/third_party/closure_library/closure/goog/math/size.js
|
| index 1b3841baf08dd94728f7cd04de1bd556b837e6f4..f5c379b72b02c098a84f7dd83659d20962238da6 100644
|
| --- a/third_party/google_input_tools/third_party/closure_library/closure/goog/math/size.js
|
| +++ b/third_party/google_input_tools/third_party/closure_library/closure/goog/math/size.js
|
| @@ -14,6 +14,7 @@
|
|
|
| /**
|
| * @fileoverview A utility class for representing two-dimensional sizes.
|
| + * @author brenneman@google.com (Shawn Brenneman)
|
| */
|
|
|
|
|
| @@ -26,6 +27,7 @@ goog.provide('goog.math.Size');
|
| * width and height support is deprecated and results in compiler warning.
|
| * @param {number} width Width.
|
| * @param {number} height Height.
|
| + * @struct
|
| * @constructor
|
| */
|
| goog.math.Size = function(width, height) {
|
| @@ -190,6 +192,25 @@ goog.math.Size.prototype.scale = function(sx, opt_sy) {
|
|
|
|
|
| /**
|
| + * Uniformly scales the size to perfectly cover the dimensions of a given size.
|
| + * If the size is already larger than the target, it will be scaled down to the
|
| + * minimum size at which it still covers the entire target. The original aspect
|
| + * ratio will be preserved.
|
| + *
|
| + * This function assumes that both Sizes contain strictly positive dimensions.
|
| + * @param {!goog.math.Size} target The target size.
|
| + * @return {!goog.math.Size} This Size object, after optional scaling.
|
| + */
|
| +goog.math.Size.prototype.scaleToCover = function(target) {
|
| + var s = this.aspectRatio() <= target.aspectRatio() ?
|
| + target.width / this.width :
|
| + target.height / this.height;
|
| +
|
| + return this.scale(s);
|
| +};
|
| +
|
| +
|
| +/**
|
| * Uniformly scales the size to fit inside the dimensions of a given size. The
|
| * original aspect ratio will be preserved.
|
| *
|
|
|