Dimensions.js 989 B

1234567891011121314151617181920212223242526
  1. import { isValidNumber } from '../utils';
  2. var Dimensions = /** @class */ (function () {
  3. function Dimensions(width, height) {
  4. if (!isValidNumber(width) || !isValidNumber(height)) {
  5. throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have " + JSON.stringify({ width: width, height: height }));
  6. }
  7. this._width = width;
  8. this._height = height;
  9. }
  10. Object.defineProperty(Dimensions.prototype, "width", {
  11. get: function () { return this._width; },
  12. enumerable: true,
  13. configurable: true
  14. });
  15. Object.defineProperty(Dimensions.prototype, "height", {
  16. get: function () { return this._height; },
  17. enumerable: true,
  18. configurable: true
  19. });
  20. Dimensions.prototype.reverse = function () {
  21. return new Dimensions(1 / this.width, 1 / this.height);
  22. };
  23. return Dimensions;
  24. }());
  25. export { Dimensions };
  26. //# sourceMappingURL=Dimensions.js.map