Skip to content

Commit

Permalink
parse dimensions from presentation 3 resource
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Sep 30, 2018
1 parent 45be800 commit eaa5a7a
Show file tree
Hide file tree
Showing 8 changed files with 7,800 additions and 18 deletions.
33 changes: 22 additions & 11 deletions dist/@iiif/manifold.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@ var Manifesto;
Behavior.prototype.nonav = function () {
return new Behavior(Behavior.NONAV.toString());
};
Behavior.prototype.paged = function () {
return new Behavior(Behavior.PAGED.toString());
};
Behavior.AUTOADVANCE = new Behavior("auto-advance");
Behavior.NONAV = new Behavior("no-nav");
Behavior.PAGED = new Behavior("paged");
return Behavior;
}(Manifesto.StringValue));
Manifesto.Behavior = Behavior;
Expand Down Expand Up @@ -765,7 +769,14 @@ var Manifesto;
return new Manifesto.IIIFResourceType(Manifesto.Utils.normaliseType(this.getProperty('type')));
};
ManifestResource.prototype.getLabel = function () {
return Manifesto.LanguageMap.parse(this.getProperty('label'), this.options.locale);
var label = this.getProperty('label');
if (label) {
return Manifesto.LanguageMap.parse(label, this.options.locale);
}
return [];
};
ManifestResource.prototype.getDefaultLabel = function () {
return Manifesto.LanguageMap.getValue(this.getLabel());
};
ManifestResource.prototype.getMetadata = function () {
var _metadata = this.getProperty('metadata');
Expand Down Expand Up @@ -1199,16 +1210,6 @@ var Manifesto;
IIIFResource.prototype.getSeeAlso = function () {
return this.getProperty('seeAlso');
};
IIIFResource.prototype.getLabel = function () {
var label = this.getProperty('label');
if (label) {
return Manifesto.LanguageMap.parse(label, this.options.locale);
}
return [];
};
IIIFResource.prototype.getDefaultLabel = function () {
return Manifesto.LanguageMap.getValue(this.getLabel());
};
IIIFResource.prototype.getDefaultTree = function () {
this.defaultTree = new Manifesto.TreeNode('root');
this.defaultTree.data = this;
Expand Down Expand Up @@ -1498,6 +1499,10 @@ var Manifesto;
if (viewingHint) {
return viewingHint.toString() === Manifesto.ViewingHint.PAGED.toString();
}
var behavior = this.getBehavior();
if (behavior) {
return behavior.toString() === Manifesto.Behavior.PAGED.toString();
}
return false;
};
Manifest.prototype.getViewingDirection = function () {
Expand Down Expand Up @@ -3448,6 +3453,12 @@ var Manifesto;
}
return null;
};
AnnotationBody.prototype.getWidth = function () {
return this.getProperty('width');
};
AnnotationBody.prototype.getHeight = function () {
return this.getProperty('height');
};
return AnnotationBody;
}(Manifesto.ManifestResource));
Manifesto.AnnotationBody = AnnotationBody;
Expand Down
12 changes: 12 additions & 0 deletions dist/@iiif/manifold.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,18 @@ var Manifold;
this.width = resource.getWidth();
this.height = resource.getHeight();
}
else {
// presentation 3
images = canvas.getContent();
if (images.length) {
var annotation = images[0];
var body = annotation.getBody();
if (body.length) {
this.width = body[0].getWidth();
this.height = body[0].getHeight();
}
}
}
};
ExternalResource.prototype.isAccessControlled = function () {
if (this.clickThroughService || this.loginService || this.externalService || this.kioskService || this.probeService) {
Expand Down
2 changes: 1 addition & 1 deletion dist/manifold.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @iiif/manifold v1.2.35 https://github.com/iiif-commons/manifold#readme
// @iiif/manifold v1.2.36 https://github.com/iiif-commons/manifold#readme
interface Window {
manifestCallback: any;
}
Expand Down
14 changes: 13 additions & 1 deletion dist/manifold.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @iiif/manifold v1.2.35 https://github.com/iiif-commons/manifold#readme
// @iiif/manifold v1.2.36 https://github.com/iiif-commons/manifold#readme
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.iiifmanifold = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){

Expand Down Expand Up @@ -367,6 +367,18 @@ var Manifold;
this.width = resource.getWidth();
this.height = resource.getHeight();
}
else {
// presentation 3
images = canvas.getContent();
if (images.length) {
var annotation = images[0];
var body = annotation.getBody();
if (body.length) {
this.width = body[0].getWidth();
this.height = body[0].getHeight();
}
}
}
};
ExternalResource.prototype.isAccessControlled = function () {
if (this.clickThroughService || this.loginService || this.externalService || this.kioskService || this.probeService) {
Expand Down
4 changes: 2 additions & 2 deletions dist/manifold.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit eaa5a7a

Please sign in to comment.