mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 13:33:03 +00:00
Added mobile breakpoint for mirador viewer configuration.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
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 { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
@@ -46,4 +46,5 @@ export class IIIFSearchableComponent extends ItemComponent implements OnInit {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,8 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
|
|
||||||
multi = false;
|
multi = false;
|
||||||
|
|
||||||
|
notMobile = false;
|
||||||
|
|
||||||
constructor(private sanitizer: DomSanitizer,
|
constructor(private sanitizer: DomSanitizer,
|
||||||
private bitstreamDataService: BitstreamDataService,
|
private bitstreamDataService: BitstreamDataService,
|
||||||
@Inject(PLATFORM_ID) private platformId: any) {
|
@Inject(PLATFORM_ID) private platformId: any) {
|
||||||
@@ -40,6 +42,7 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
* or multi-page thumbnail navigation.
|
* or multi-page thumbnail navigation.
|
||||||
*/
|
*/
|
||||||
setURL() {
|
setURL() {
|
||||||
|
const width = window.innerWidth;
|
||||||
// The path to the REST manifest endpoint.
|
// The path to the REST manifest endpoint.
|
||||||
const manifestApiEndpoint = encodeURIComponent(environment.rest.baseUrl + '/api/iiif/'
|
const manifestApiEndpoint = encodeURIComponent(environment.rest.baseUrl + '/api/iiif/'
|
||||||
+ this.item.id + '/manifest');
|
+ 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.
|
// Tell the viewer to add thumbnail navigation. If searchable, thumbnail navigation is added by default.
|
||||||
viewerPath += '&multi=' + this.multi;
|
viewerPath += '&multi=' + this.multi;
|
||||||
}
|
}
|
||||||
|
if (this.notMobile) {
|
||||||
|
viewerPath += '¬Mobile=true';
|
||||||
|
}
|
||||||
// TODO: review whether the item.id should be sanitized. The query term should be (check mirador viewer).
|
// TODO: review whether the item.id should be sanitized. The query term should be (check mirador viewer).
|
||||||
return this.sanitizer.bypassSecurityTrustResourceUrl(viewerPath);
|
return this.sanitizer.bypassSecurityTrustResourceUrl(viewerPath);
|
||||||
}
|
}
|
||||||
@@ -66,6 +72,9 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
* Initializes the iframe url observable.
|
* Initializes the iframe url observable.
|
||||||
*/
|
*/
|
||||||
if (isPlatformBrowser(this.platformId)) {
|
if (isPlatformBrowser(this.platformId)) {
|
||||||
|
if (window.innerWidth > 768) {
|
||||||
|
this.notMobile = true;
|
||||||
|
}
|
||||||
this.iframeViewerUrl = this.bitstreamDataService
|
this.iframeViewerUrl = this.bitstreamDataService
|
||||||
.findAllByItemAndBundleName(this.item, 'IIIF', {})
|
.findAllByItemAndBundleName(this.item, 'IIIF', {})
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@@ -9,6 +9,7 @@ const manifest = params.get('manifest');
|
|||||||
const searchable = params.get('searchable');
|
const searchable = params.get('searchable');
|
||||||
const query = params.get('query');
|
const query = params.get('query');
|
||||||
const multi = params.get('multi');
|
const multi = params.get('multi');
|
||||||
|
const notMobile = params.get('notMobile');
|
||||||
|
|
||||||
let windowSettings = {};
|
let windowSettings = {};
|
||||||
let sidbarPanel = 'info';
|
let sidbarPanel = 'info';
|
||||||
@@ -19,21 +20,22 @@ let thumbNavigation = 'off';
|
|||||||
windowSettings.manifestId = manifest;
|
windowSettings.manifestId = manifest;
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
console.log('setting params in viewer');
|
|
||||||
if (searchable) {
|
if (searchable) {
|
||||||
console.log(multi)
|
|
||||||
defaultView = 'book';
|
defaultView = 'book';
|
||||||
sidbarPanel = 'search';
|
sidbarPanel = 'search';
|
||||||
multipleItems = true;
|
multipleItems = true;
|
||||||
thumbNavigation = 'far-right';
|
if (notMobile) {
|
||||||
|
thumbNavigation = 'far-right';
|
||||||
|
}
|
||||||
if (query !== 'null') {
|
if (query !== 'null') {
|
||||||
windowSettings.defaultSearchQuery = query;
|
windowSettings.defaultSearchQuery = query;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(multi)
|
|
||||||
if(multi) {
|
if(multi) {
|
||||||
multipleItems = multi;
|
multipleItems = multi;
|
||||||
thumbNavigation = 'far-right';
|
if (notMobile) {
|
||||||
|
thumbNavigation = 'far-right';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@@ -126,7 +128,7 @@ windowSettings.manifestId = manifest;
|
|||||||
allowFullscreen: true,
|
allowFullscreen: true,
|
||||||
allowMaximize: false,
|
allowMaximize: false,
|
||||||
defaultView: defaultView,
|
defaultView: defaultView,
|
||||||
sideBarOpen: true,
|
sideBarOpen: notMobile,
|
||||||
allowTopMenuButton: true,
|
allowTopMenuButton: true,
|
||||||
defaultSidebarPanelWidth: 230,
|
defaultSidebarPanelWidth: 230,
|
||||||
switchCanvasOnSearch: true,
|
switchCanvasOnSearch: true,
|
||||||
|
Reference in New Issue
Block a user