Skip to content

Commit

Permalink
check if duration end before start
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Jun 22, 2018
1 parent 72595c8 commit a8bb99a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
7 changes: 6 additions & 1 deletion dist/client/manifesto.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,12 @@ var Manifesto;
Range.prototype.spansTime = function (time) {
var duration = this.getDuration();
if (duration) {
if (time >= duration.start && time <= duration.end) {
// if the end is before the start, it means it spans multiple canvases.
// therefore just check to see if the time is after the start.
if (duration.end < duration.start && time >= duration.start) {
return true;
}
else if (time >= duration.start && time <= duration.end) {
return true;
}
}
Expand Down
9 changes: 7 additions & 2 deletions dist/client/manifesto.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto v2.2.25 https://github.com/iiif-commons/manifesto
// manifesto v2.2.26 https://github.com/iiif-commons/manifesto
(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.manifesto = 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 @@ -1599,7 +1599,12 @@ var Manifesto;
Range.prototype.spansTime = function (time) {
var duration = this.getDuration();
if (duration) {
if (time >= duration.start && time <= duration.end) {
// if the end is before the start, it means it spans multiple canvases.
// therefore just check to see if the time is after the start.
if (duration.end < duration.start && time >= duration.start) {
return true;
}
else if (time >= duration.start && time <= duration.end) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/manifesto.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto v2.2.25 https://github.com/iiif-commons/manifesto
// manifesto v2.2.26 https://github.com/iiif-commons/manifesto

declare namespace Manifesto {
class StringValue {
Expand Down
9 changes: 7 additions & 2 deletions dist/server/manifesto.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "manifesto.js",
"version": "2.2.25",
"version": "2.2.26",
"description": "IIIF Presentation API utility library for client and server",
"main": "./dist/server/manifesto.js",
"types": "./dist/manifesto.d.ts",
Expand Down
8 changes: 7 additions & 1 deletion src/Range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ namespace Manifesto {
const duration: Duration | undefined = this.getDuration();

if (duration) {
if (time >= duration.start && time <= duration.end) {

// if the end is before the start, it means it spans multiple canvases.
// therefore just check to see if the time is after the start.

if (duration.end < duration.start && time >= duration.start) {
return true;
} else if (time >= duration.start && time <= duration.end) {
return true;
}
}
Expand Down

0 comments on commit a8bb99a

Please sign in to comment.