Dimensions.js 1.1 KB

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