2020-08-20 02:05:34 +02:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.Dimensions = void 0;
|
|
|
|
const utils_1 = require("../utils");
|
|
|
|
class Dimensions {
|
2020-08-18 14:04:33 +02:00
|
|
|
constructor(width, height) {
|
2020-08-20 02:05:34 +02:00
|
|
|
if (!utils_1.isValidNumber(width) || !utils_1.isValidNumber(height)) {
|
2020-08-18 14:04:33 +02:00
|
|
|
throw new Error(`Dimensions.constructor - expected width and height to be valid numbers, instead have ${JSON.stringify({ width, height })}`);
|
|
|
|
}
|
|
|
|
this._width = width;
|
|
|
|
this._height = height;
|
|
|
|
}
|
|
|
|
get width() { return this._width; }
|
|
|
|
get height() { return this._height; }
|
|
|
|
reverse() {
|
|
|
|
return new Dimensions(1 / this.width, 1 / this.height);
|
|
|
|
}
|
|
|
|
}
|
2020-08-20 02:05:34 +02:00
|
|
|
exports.Dimensions = Dimensions;
|
2020-08-18 14:04:33 +02:00
|
|
|
//# sourceMappingURL=Dimensions.js.map
|