From 169bd3165d5d8e6dbcd2135acabc4754fb0d755c Mon Sep 17 00:00:00 2001 From: Glenn Fischer <gfischer@ub.uni-leipzig.de> Date: Thu, 21 Feb 2019 17:23:19 +0100 Subject: [PATCH] #1888 move implementation of <ValidationCanvas> into <ManifestoCanvas> --- src/lib/ManifestoCanvas.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/lib/ManifestoCanvas.js b/src/lib/ManifestoCanvas.js index 885e080df..756d286a4 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 -- GitLab