Added mobile breakpoint for mirador viewer configuration.

This commit is contained in:
Michael Spalti
2021-03-30 13:46:28 -07:00
parent f52ed2a218
commit c0aac8a5e9
3 changed files with 19 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
import { RouteService } from '../../../../core/services/route.service';
import { Observable } from 'rxjs/internal/Observable';
@@ -46,4 +46,5 @@ export class IIIFSearchableComponent extends ItemComponent implements OnInit {
})
);
}
}

View File

@@ -30,6 +30,8 @@ export class MiradorViewerComponent implements OnInit {
multi = false;
notMobile = false;
constructor(private sanitizer: DomSanitizer,
private bitstreamDataService: BitstreamDataService,
@Inject(PLATFORM_ID) private platformId: any) {
@@ -40,6 +42,7 @@ export class MiradorViewerComponent implements OnInit {
* or multi-page thumbnail navigation.
*/
setURL() {
const width = window.innerWidth;
// The path to the REST manifest endpoint.
const manifestApiEndpoint = encodeURIComponent(environment.rest.baseUrl + '/api/iiif/'
+ this.item.id + '/manifest');
@@ -57,6 +60,9 @@ export class MiradorViewerComponent implements OnInit {
// Tell the viewer to add thumbnail navigation. If searchable, thumbnail navigation is added by default.
viewerPath += '&multi=' + this.multi;
}
if (this.notMobile) {
viewerPath += '&notMobile=true';
}
// TODO: review whether the item.id should be sanitized. The query term should be (check mirador viewer).
return this.sanitizer.bypassSecurityTrustResourceUrl(viewerPath);
}
@@ -66,6 +72,9 @@ export class MiradorViewerComponent implements OnInit {
* Initializes the iframe url observable.
*/
if (isPlatformBrowser(this.platformId)) {
if (window.innerWidth > 768) {
this.notMobile = true;
}
this.iframeViewerUrl = this.bitstreamDataService
.findAllByItemAndBundleName(this.item, 'IIIF', {})
.pipe(

View File

@@ -9,6 +9,7 @@ const manifest = params.get('manifest');
const searchable = params.get('searchable');
const query = params.get('query');
const multi = params.get('multi');
const notMobile = params.get('notMobile');
let windowSettings = {};
let sidbarPanel = 'info';
@@ -19,21 +20,22 @@ let thumbNavigation = 'off';
windowSettings.manifestId = manifest;
(() => {
console.log('setting params in viewer');
if (searchable) {
console.log(multi)
defaultView = 'book';
sidbarPanel = 'search';
multipleItems = true;
thumbNavigation = 'far-right';
if (notMobile) {
thumbNavigation = 'far-right';
}
if (query !== 'null') {
windowSettings.defaultSearchQuery = query;
}
} else {
console.log(multi)
if(multi) {
multipleItems = multi;
thumbNavigation = 'far-right';
if (notMobile) {
thumbNavigation = 'far-right';
}
}
}
})();
@@ -126,7 +128,7 @@ windowSettings.manifestId = manifest;
allowFullscreen: true,
allowMaximize: false,
defaultView: defaultView,
sideBarOpen: true,
sideBarOpen: notMobile,
allowTopMenuButton: true,
defaultSidebarPanelWidth: 230,
switchCanvasOnSearch: true,