diff --git a/README.md b/README.md index 4fb5642a546190573fcab12ecc7d84a8db4aa445..105dbb3b602f201f91cdd509663bce7177e832a1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [](https://travis-ci.org/ProjectMirador/mirador?branch=master) [](http://waffle.io/iiif/mirador) -#Mirador +# Mirador  **Mirador is a multi-repository, configurable, extensible, and easy-to-integrate viewer and annotation creation and comparison environment for IIIF resources, ranging from deep-zooming artwork, to complex manuscript objects. It provides a tiling windowed environment for comparing multiple image-based resources, synchronised structural and visual navigation of content using openSeadragon, Open Annotation compliant annotation creation and viewing on deep-zoomable canvases, metadata display, bookreading, and bookmarking.** diff --git a/index.html b/index.html index 9c1d7f604a9fc5bfa8675e1f9159e6204677ac39..da19f2b3d6025115004e5969c430dff9f3693720 100644 --- a/index.html +++ b/index.html @@ -67,7 +67,7 @@ { "manifestUri": "https://data.ucd.ie/api/img/manifests/ucdlib:30708", "location": "University College Dublin"}, { "manifestUri": "http://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/manifest.json", "location": "University of Tokyo"}, { "manifestUri": "http://www2.dhii.jp/nijl/NIJL0018/099-0014/manifest_tags.json", "location": "NIJL"}, - /* { "manifestUri": "http://digi.vatlib.it/iiif/MSS_Vat.lat.3225/manifest.json", "location": "Vatican Library"},*/ + { "manifestUri": "http://digi.vatlib.it/iiif/MSS_Vat.lat.3225/manifest.json", "location": "Vatican Library"}, { "manifestUri": "http://media.nga.gov/public/manifests/nga_highlights.json", "location": "National Gallery of Art"}, { "manifestUri": "http://demos.biblissima-condorcet.fr/iiif/metadata/BVMM/chateauroux/manifest.json", "location": "Biblissima"}, { "manifestUri": "http://manifests.ydc2.yale.edu/manifest/Osbornfa1v2.json", "location": "Yale Beinecke"}, diff --git a/js/src/widgets/imageView.js b/js/src/widgets/imageView.js index 75e4d6c1b5eabf9331326a773b2fb70ee52ee77e..6f1c3bb5cac80cd88a48f55493853f35acc61aad 100755 --- a/js/src/widgets/imageView.js +++ b/js/src/widgets/imageView.js @@ -530,7 +530,6 @@ } }, hideImage: function(event, imageResource) { - console.log('hidden'); if (imageResource.getStatus() === 'drawn') { imageResource.osdTiledImage.setOpacity(0); } diff --git a/js/src/workspaces/window.js b/js/src/workspaces/window.js index f244c8252d6fc8ac9b89c65b958f7e0382170d83..8d99ac6c8d2dca004eed63dd4d2f513a52847244 100644 --- a/js/src/workspaces/window.js +++ b/js/src/workspaces/window.js @@ -560,13 +560,9 @@ _this.adjustFocusSize(panelType, displayed); } - //update current image for all valid panels }); }); - //update panels with current image - //console.log(this.focusImages); - //if (this.bottomPanel) { this.bottomPanel.updateFocusImages(this.focusImages); } }, updateSidePanel: function() { diff --git a/spec/annotations/osd-svg-overlay.test.js b/spec/annotations/osd-svg-overlay.test.js index 215dfbd8182d168dc0be4f32e1e8952dae93fdab..1e8c61ebc239b524f1a2be187e314aeb01f2b19d 100644 --- a/spec/annotations/osd-svg-overlay.test.js +++ b/spec/annotations/osd-svg-overlay.test.js @@ -23,9 +23,14 @@ describe('Overlay', function() { jasmine.getFixtures().set(this.canvas); this.eventEmitter = new Mirador.EventEmitter();// TODO should stub this.windowObjMock = { + 'id': id, 'windowId': id, 'viewer': { 'id': 'viewerId' + }, + 'canvasID': 'myCanvasId', + 'canvases': { + 'myCanvasId': {} } }; this.viewerMock = { @@ -75,7 +80,10 @@ describe('Overlay', function() { 'fillColorAlpha': 0.0 }; - var state = new Mirador.SaveController({eventEmitter: this.eventEmitter}); // TODO should stub this + var state = new Mirador.SaveController({ + eventEmitter: this.eventEmitter, + windowObjects: [this.windowObjMock] + }); // TODO should stub this state.getStateProperty = function(key) { if (key === 'drawingToolsSettings') { @@ -95,6 +103,12 @@ describe('Overlay', function() { return null; }; + state.currentConfig.windowObjects[0].canvases['myCanvasId'].getBounds = function() { + return { + 'x': 800, + 'y': 600 + }; + }; this.overlay = new Mirador.Overlay(this.viewerMock, this.windowObjMock.viewer.id, this.windowObjMock.windowId, state, new MockEventEmitter(this.eventEmitter)); this.overlay.annotationUtils = new AnnotationUtilsStub(); }); diff --git a/spec/widgets/imageView.test.js b/spec/widgets/imageView.test.js index 902620cd55d2dd69d946c6f05b70f1469bf59f8a..ace28e8f8925e91879a7ce10ccedc77020f1813b 100644 --- a/spec/widgets/imageView.test.js +++ b/spec/widgets/imageView.test.js @@ -14,16 +14,16 @@ describe('ImageView', function() { 3372.000000000001, 0 ); - + beforeEach(function() { jasmine.getJSONFixtures().fixturesPath = 'spec/fixtures'; // WARNING: Need to stub to stop OpenSeadragon from crashing PhantomJS // If you can make this not happen, remove this line and test the method - spyOn(Mirador.ImageView.prototype, 'createOpenSeadragonInstance'); + spyOn(Mirador.ImageView.prototype, 'initialiseImageCanvas'); this.viewContainer = document.createElement('div', { class: 'view-container' }); - this.fixture = getJSONFixture('BNF-condorcet-florus-dispersus-manifest.json'); + this.fixture = getJSONFixture('Richardson7manifest.json'); this.manifest = new Mirador.Manifest( this.fixture['@id'], 'IIIF', this.fixture ); @@ -47,7 +47,35 @@ describe('ImageView', function() { bottomPanelAvailable: true, annoEndpointAvailable: false, canvasControls: this.canvasControls, - annotationState: this.canvasControls.annotations.annotationState + annotationState: this.canvasControls.annotations.annotationState, + canvases: { + 'https://oculus-dev.harvardx.harvard.edu/manifests/drs:5981093/canvas/canvas-5981094.json': { + getVisibleImages: function() { return []; }, + getBounds: function() { + return { + 'x': 800, + 'y': 600, + 'width': 800, + 'height': 600 + }; + }, + show: function() { + } + }, + 'https://oculus-dev.harvardx.harvard.edu/manifests/drs:5981093/canvas/canvas-5981096.json': { + getVisibleImages: function() { return []; }, + getBounds: function() { + return { + 'x': 800, + 'y': 600, + 'width': 800, + 'height': 600 + }; + }, + show: function() { + } + } + } }); subject = this.imageView; }); @@ -55,7 +83,7 @@ describe('ImageView', function() { afterEach(function() { delete this.imageView; }); - + // TODO: Fill in tests for what needs initializing xdescribe('Initialization', function() { it('should initialize', function() { @@ -227,13 +255,13 @@ describe('ImageView', function() { subject.element.find('.mirador-osd-next').click(); expect(subject.next).toHaveBeenCalled(); }); - + it('should respond to clicks on previous', function() { spyOn(subject, 'previous'); subject.element.find('.mirador-osd-previous').click(); expect(subject.previous).toHaveBeenCalled(); }); - + it('should respond to clicks on rotate right', function() { subject.osd = { viewport: { @@ -244,7 +272,7 @@ describe('ImageView', function() { subject.element.find('.mirador-osd-rotate-right').click(); expect(subject.osd.viewport.setRotation).toHaveBeenCalledWith(180); }); - + it('should respond to clicks on rotate left', function() { subject.osd = { viewport: { @@ -255,7 +283,7 @@ describe('ImageView', function() { subject.element.find('.mirador-osd-rotate-left').click(); expect(subject.osd.viewport.setRotation).toHaveBeenCalledWith(180); }); - + it('should respond to clicks on home', function() { subject.osd = { viewport: { @@ -265,13 +293,13 @@ describe('ImageView', function() { subject.element.find('.mirador-osd-go-home').click(); expect(subject.osd.viewport.goHome).toHaveBeenCalled(); }); - + it('should toggle bottom panel', function() { spyOn(subject.eventEmitter, 'publish'); subject.element.find('.mirador-osd-toggle-bottom-panel').click(); expect(subject.eventEmitter.publish).toHaveBeenCalledWith('TOGGLE_BOTTOM_PANEL_VISIBILITY.' + this.windowId); }); - + describe('direction buttons', function() { var panPoint = new OpenSeadragon.Point(1, 2); beforeEach(function() { @@ -297,7 +325,7 @@ describe('ImageView', function() { expect(subject.osd.viewport.panBy).toHaveBeenCalledWith(new OpenSeadragon.Point(1, 0)); }); }); - + describe('zoom buttons', function() { beforeEach(function() { subject.osd = { @@ -314,7 +342,7 @@ describe('ImageView', function() { expect(subject.osd.viewport.zoomBy).toHaveBeenCalledWith(1/2); }); }); - + describe('annotation layer toggle', function() { beforeEach(function() { spyOn(subject.hud.annoState, 'startup'); @@ -337,7 +365,7 @@ describe('ImageView', function() { expect(subject.hud.annoState.displayOff).toHaveBeenCalled(); }); }); - + describe('manipulation toggle', function() { beforeEach(function() { spyOn(subject.hud.manipulationState, 'startup'); @@ -360,7 +388,7 @@ describe('ImageView', function() { expect(subject.hud.manipulationState.displayOff).toHaveBeenCalled(); }); }); - + // TODO: Find way to test annotation and manipulation tools without // "displayOn inappropriate in current state pointer" error }); @@ -460,7 +488,7 @@ describe('ImageView', function() { expect(subject.eventEmitter.publish).toHaveBeenCalledWith('ADD_CLASS.'+this.windowId, 'xekko'); }); }); - + describe('adjustHeight', function() { it('should remove class when hasClass is true', function() { subject.element.addClass('xekko'); @@ -475,7 +503,7 @@ describe('ImageView', function() { }); // WARNING: This method has been spied out to stop PhantomJS from crashing. - xdescribe('createOpenSeadragonInstance', function() { + xdescribe('initialiseImageCanvas', function() { }); @@ -492,23 +520,28 @@ describe('ImageView', function() { // TODO: Fix openseadragon crash describe('updateImage', function() { beforeEach(function() { - subject.canvasId = this.imagesList[0]['@id']; + var oldCanvasID = this.imagesList[0]['@id']; + subject.canvasID = oldCanvasID; spyOn(subject.eventEmitter, 'publish'); }); describe('Different from original', function() { beforeEach(function() { subject.osd = { - close: function() {} + viewport: { + imageToViewportRectangle: jasmine.createSpy('imageToViewportRectangle').and.returnValue(new OpenSeadragon.Rect(1, 2, 640, 480, 0)), + fitBoundsWithConstraints: jasmine.createSpy('fitBoundsWithConstraints'), + fitBounds: jasmine.createSpy('fitBoundsWithConstraints') + } }; - spyOn(subject.osd, 'close'); subject.updateImage(this.imagesList[1]['@id']); }); + it('should change the canvasID on the object', function() { + expect(subject.canvasID).not.toEqual(this.imagesList[0]['@id']); + expect(subject.canvasID).toEqual(this.imagesList[1]['@id']); + }); it('should fire event', function() { expect(subject.eventEmitter.publish).toHaveBeenCalled(); }); - it('should close Openseadragon', function() { - expect(subject.osd.close).toHaveBeenCalled(); - }); }); describe('Same as original', function() { beforeEach(function() { @@ -555,4 +588,4 @@ describe('ImageView', function() { expect(this.eventEmitter.publish).not.toHaveBeenCalled(); }); }); -}); +}); diff --git a/spec/workspaces/window.test.js b/spec/workspaces/window.test.js index 9cfd9422d4c3ded9dc0251d9e2ef45508d7bb9da..e3b3a57a429e658bfc3f82f05aa9fb08edcd54ee 100644 --- a/spec/workspaces/window.test.js +++ b/spec/workspaces/window.test.js @@ -45,9 +45,36 @@ describe('Window', function() { }] }, getCanvases: function() { return [{ - '@id': '', - 'images':[{ - }] + // This is an example of one canvas from richardson 7. + label: "(seq. 3)", + width: 4680, + '@type': "sc:Canvas", + images: [ + { + resource: { + service: { + profile: "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", + '@context': "http://iiif.io/api/image/1/context.json", + '@id': "https://ids.lib.harvard.edu/ids/iiif/5981098" + }, + format: "image/jpeg", + height: 5112, + width: 4680, + '@id': "https://ids.lib.harvard.edu/ids/iiif/5981098/full/full/0/native.jpg", + '@type': "dctypes:Image" + }, + on: "https://iiif.lib.harvard.edu/manifests/drs:5981093/canvas/canvas-5981098.json", + motivation: "sc:painting", + '@id': "https://iiif.lib.harvard.edu/manifests/drs:5981093/annotation/anno-5981098.json", + '@type': "oa:Annotation" + } + ], + height: 5112, + '@id': "https://iiif.lib.harvard.edu/manifests/drs:5981093/canvas/canvas-5981098.json", + thumbnail: { + '@id': "https://ids.lib.harvard.edu/ids/iiif/5981098/full/,150/0/native.jpg", + '@type': "dctypes:Image" +} }]; }, getAnnotationsListUrls: function() {