diff --git a/src/components/ValidationCanvas.js b/src/components/ValidationCanvas.js deleted file mode 100644 index dc3ed584ef790770d9f7887f516fa0abddad129c..0000000000000000000000000000000000000000 --- a/src/components/ValidationCanvas.js +++ /dev/null @@ -1,35 +0,0 @@ -import ManifestoCanvas from '../lib/ManifestoCanvas'; - -/** - */ -export class ValidationCanvas extends ManifestoCanvas { - /** - * 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 - ); - } -} diff --git a/src/components/WindowSideBarCanvasPanel.js b/src/components/WindowSideBarCanvasPanel.js index ed05c9d4a2b2ffe6c1820088d08d318dd70d51b0..58ff4ee6257224ccb89ce24dd54fe1185821d1cf 100644 --- a/src/components/WindowSideBarCanvasPanel.js +++ b/src/components/WindowSideBarCanvasPanel.js @@ -5,7 +5,7 @@ import Typography from '@material-ui/core/Typography'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import { CanvasThumbnail } from './CanvasThumbnail'; -import { ValidationCanvas } from './ValidationCanvas'; +import ManifestoCanvas from '../lib/ManifestoCanvas'; import { getIdAndLabelOfCanvases } from '../state/selectors'; /** @@ -35,8 +35,9 @@ export class WindowSideBarCanvasPanel extends Component { <List> { canvasesIdAndLabel.map((canvas, canvasIndex) => { - const validationCanvas = new ValidationCanvas(canvases[canvasIndex]); - const isValid = validationCanvas.hasValidDimensions; + const { width, height } = config.canvasNavigation; + const manifestoCanvas = new ManifestoCanvas(canvases[canvasIndex]); + const isValid = manifestoCanvas.hasValidDimensions; const onClick = () => { setCanvas(windowId, canvasIndex); }; // eslint-disable-line require-jsdoc, max-len return ( @@ -47,7 +48,7 @@ export class WindowSideBarCanvasPanel extends Component { <CanvasThumbnail className={classNames(classes.clickable)} isValid={isValid} - imageUrl={validationCanvas.thumbnail(config.canvasNavigation.height)} + imageUrl={manifestoCanvas.thumbnail(config.canvasNavigation.height)} onClick={onClick} style={{ cursor: 'pointer', diff --git a/src/components/index.js b/src/components/index.js index e624b5872b0f962af411342fe7ee3d2ecc50a4cb..72c49d7c4f66d2a1cb5f034b3f017f86e117c5b1 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -10,7 +10,6 @@ export * from './NestedMenu'; export * from './OpenSeadragonViewer'; export * from './SanitizedHtml'; export * from './ThumbnailNavigation'; -export * from './ValidationCanvas'; export * from './ViewerNavigation'; export * from './Window'; export * from './WindowList'; diff --git a/src/lib/ManifestoCanvas.js b/src/lib/ManifestoCanvas.js index 7952804d241b32b22dc11975ef9566b1c3ba56bd..7f243436b448c177f0227baa6da4b2e1cc919f7c 100644 --- a/src/lib/ManifestoCanvas.js +++ b/src/lib/ManifestoCanvas.js @@ -52,4 +52,34 @@ export default class ManifestoCanvas { return this.canonicalImageUri.replace(/\/full\/.*\/0\//, `/full/${width},/0/`); } + + /** + * 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 + ); + } }