Skip to content
Snippets Groups Projects
Select Git revision
  • 524b4ee6777ec90c11393625352d5aa9b885fab5
  • master default protected
  • multiprocessing
  • experiment/clara
  • experiment/spec2B-poc
  • experiment/qivalio-poc
  • experiment/ertms
  • MAY-2023
  • FEB-2023
  • EGC-2023
  • 0.2.1
  • v0.2.0
  • v0.1.2
13 results

SolarSystemDevtest-83_preprocessing.ttl

Blame
  • ManifestoCanvas.js 937 B
    /**
     * ManifestoCanvas - adds additional, testable logic around Manifesto's Canvas
     * https://iiif-commons.github.io/manifesto/classes/_canvas_.manifesto.canvas.html
     */
    export default class ManifestoCanvas {
      /**
       * @param {ManifestoCanvas} canvas
       */
      constructor(canvas) {
        this.canvas = canvas;
      }
    
      /**
       */
      get canonicalImageUri() {
        return this.canvas.getCanonicalImageUri();
      }
    
      /**
       */
      get aspectRatio() {
        return this.canvas.getWidth() / this.canvas.getHeight();
      }
    
      /**
       */
      get imageInformationUri() {
        return `${
          this.canvas.getImages()[0].getResource().getServices()[0].id.replace(/\/$/, '')
        }/info.json`;
      }
    
      /**
       * Creates a canonical image request for a thumb
       * @param {Number} height
       */
      thumbnail(height = 150) {
        const width = Math.floor(height * this.aspectRatio);
        return this.canonicalImageUri.replace(/\/full\/.*\/0\//, `/full/${width},/0/`);
      }
    }