diff --git a/src/lib/ManifestoCanvas.js b/src/lib/ManifestoCanvas.js index 885e080dfc3ed1ccae09f3c1a8258776d98ef51b..756d286a438fa380743f41fff472e4ca682bd319 100644 --- a/src/lib/ManifestoCanvas.js +++ b/src/lib/ManifestoCanvas.js @@ -39,6 +39,36 @@ export default class ManifestoCanvas { }/info.json`; } + /** + * checks whether the canvas has a valid height + */ + get hasValidHeight() { + return ( + typeof this.canvas.getHeight() === 'number' + && this.canvas.getHeight() > 0 + ); + } + + /** + * checks whether the canvas has a valid height + */ + get hasValidWidth() { + return ( + typeof this.canvas.getHeight() === 'number' + && this.canvas.getHeight() > 0 + ); + } + + /** + * checks whether the canvas has valid dimensions + */ + get hasValidDimensions() { + return ( + this.hasValidHeight + && this.hasValidWidth + ); + } + /** * Creates a canonical image request for a thumb * @param {Number} height