Skip to content

Commit

Permalink
added NONE metric
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Jan 4, 2018
1 parent 714e350 commit 28b5b21
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 105 deletions.
4 changes: 2 additions & 2 deletions src/extensions/uv-seadragon-extension/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Extension extends BaseExtension implements ISeadragonExtension {
super.create();

$.subscribe(BaseEvents.METRIC_CHANGED, () => {
if (this.isMobileMetric()) {
if (!this.isDesktopMetric()) {
const settings: ISettings = {};
settings.pagingEnabled = false;
this.updateSettings(settings);
Expand Down Expand Up @@ -136,7 +136,7 @@ export class Extension extends BaseExtension implements ISeadragonExtension {
});

$.subscribe(BaseEvents.LEFTPANEL_COLLAPSE_FULL_START, () => {
if (!this.isMobileMetric()) {
if (this.isDesktopMetric()) {
Shell.$rightPanel.show();
}
});
Expand Down
6 changes: 5 additions & 1 deletion src/lib/manifesto.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto v2.2.1 https://github.com/iiif-commons/manifesto
// manifesto v2.2.2 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 e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){

Expand Down Expand Up @@ -842,6 +842,10 @@ var Manifesto;
}
}
size = width + ',';
// trim off trailing '/'
if (id && id.endsWith('/')) {
id = id.substr(0, id.length - 1);
}
var uri = [id, region, size, rotation, quality + '.jpg'].join('/');
return uri;
};
Expand Down
2 changes: 1 addition & 1 deletion src/modules/uv-contentleftpanel-module/ContentLeftPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ContentLeftPanel extends LeftPanel {
});

$.subscribe(BaseEvents.METRIC_CHANGED, () => {
if (this.extension.isMobileMetric()) {
if (!this.extension.isDesktopMetric()) {
if (this.isFullyExpanded) {
this.collapseFull();
}
Expand Down
13 changes: 0 additions & 13 deletions src/modules/uv-osdmobilefooterpanel-module/css/icons.less

This file was deleted.

59 changes: 10 additions & 49 deletions src/modules/uv-osdmobilefooterpanel-module/css/styles.less
Original file line number Diff line number Diff line change
@@ -1,52 +1,13 @@
@import 'icons';
@mobile-footer-img-path: '../../../modules/uv-osdmobilefooterpanel-module/img/';

@media only screen and (min-width: @watch-min-width) and (max-width: @mobile-landscape-max-width) and (min-height: @watch-min-height) and (max-height: @mobile-portrait-max-height) {

.uv {
.footerPanel.mobile {
.@{icon-prefix}-rotate {
.icon-btn-2('@{mobile-footer-img-path}rotate_right.png');
}

@img-path: '../../../modules/uv-osdmobilefooterpanel-module/img/';

display: block;
position: relative;
height: 50px;

.options {

position: absolute;
width: 315px;

.spacer {
float: left;
width: 30px;
height: 41px;
}

.btn {

margin-right: @margin-small-horizontal;

&.bookmark {
display: none;
}

&.open {
display: none;
}

&.feedback {
display: none;
}

&.embed {
display: none;
}

&.fullScreen {
display: none;
}
}
}
}
}
.@{icon-prefix}-zoom-in {
.icon-btn-2('@{mobile-footer-img-path}zoom_in.png');
}

.@{icon-prefix}-zoom-out {
.icon-btn-2('@{mobile-footer-img-path}zoom_out.png');
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class SeadragonCenterPanel extends CenterPanel {
updateResponsiveView(): void {
this.setNavigatorVisible();

if (this.extension.isMobileMetric()) {
if (!this.extension.isDesktopMetric()) {
this.viewer.autoHideControls = false;
this.$viewportNavButtons.hide();
} else {
Expand Down Expand Up @@ -977,7 +977,7 @@ export class SeadragonCenterPanel extends CenterPanel {

setNavigatorVisible(): void {

const navigatorEnabled: boolean = Utils.Bools.getBool(this.extension.getSettings().navigatorEnabled, true) && !this.extension.isMobileMetric();
const navigatorEnabled: boolean = Utils.Bools.getBool(this.extension.getSettings().navigatorEnabled, true) && this.extension.isDesktopMetric();

this.viewer.navigator.setVisible(navigatorEnabled);

Expand Down
16 changes: 11 additions & 5 deletions src/modules/uv-shared-module/BaseExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class BaseExtension implements IExtension {
isLoggedIn: boolean = false;
lastCanvasIndex: number;
loginDialogue: LoginDialogue;
metric: MetricType = MetricType.LAPTOP;
metric: MetricType = MetricType.NONE;
metrics: Metric[] = [];
mouseX: number;
mouseY: number;
Expand Down Expand Up @@ -725,6 +725,9 @@ export class BaseExtension implements IExtension {
private _updateMetric(): void {

setTimeout(() => {

let metricChanged: boolean = false;

for (let i = 0; i < this.metrics.length; i++) {
const metric: Metric = this.metrics[i];

Expand All @@ -735,12 +738,17 @@ export class BaseExtension implements IExtension {
if (this.metric !== metric.type) {
this.metric = metric.type;

metricChanged = true;
console.log("metric changed", metric.type.toString());

$.publish(BaseEvents.METRIC_CHANGED);
}
}
}

if (!metricChanged) {
this.metric = MetricType.NONE;
}
}, 1);
}

Expand Down Expand Up @@ -1064,10 +1072,8 @@ export class BaseExtension implements IExtension {
return Shell.$overlays.is(':visible');
}

isMobileMetric(): boolean {
return this.metric.toString() === MetricType.WATCH.toString()
|| this.metric.toString() === MetricType.MOBILEPORTRAIT.toString()
|| this.metric.toString() === MetricType.MOBILELANDSCAPE.toString();
isDesktopMetric(): boolean {
return this.metric.toString() === MetricType.LAPTOP.toString();
}

viewManifest(manifest: Manifesto.IManifest): void {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/uv-shared-module/Dialogue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class Dialogue extends BaseView {

if (this.$triggerButton) {
// get the normalised position of the button
if (this.extension.isMobileMetric()) {
if (!this.extension.isDesktopMetric()) {
normalisedPos = Math.normalise(this.$triggerButton.offset().left, 0, this.extension.width());
} else {
normalisedPos = Math.normalise(this.$triggerButton.position().left, 0, this.extension.width());
Expand Down
6 changes: 3 additions & 3 deletions src/modules/uv-shared-module/FooterPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class FooterPanel extends BaseView {
$.publish(BaseEvents.TOGGLE_FULLSCREEN);
});

if (!Utils.Bools.getBool(this.options.embedEnabled, true)){
if (!Utils.Bools.getBool(this.options.embedEnabled, true)) {
this.$embedButton.hide();
}

Expand All @@ -151,7 +151,7 @@ export class FooterPanel extends BaseView {
}

// otherwise, check metric
if (this.extension.isMobileMetric()) {
if (!this.extension.isDesktopMetric()) {
this.$options.addClass('minimiseButtons');
} else {
this.$options.removeClass('minimiseButtons');
Expand All @@ -161,7 +161,7 @@ export class FooterPanel extends BaseView {
updateMoreInfoButton(): void {
const configEnabled: boolean = Utils.Bools.getBool(this.options.moreInfoEnabled, false);

if (configEnabled && this.extension.isMobileMetric()) {
if (configEnabled && !this.extension.isDesktopMetric()) {
this.$moreInfoButton.show();
} else {
this.$moreInfoButton.hide();
Expand Down
4 changes: 2 additions & 2 deletions src/modules/uv-shared-module/IExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export interface IExtension {
addTimestamp(uri: string): string;
changeLocale(locale: string): void;
component: IUVComponent;
data: IUVData;
create(): void;
createModules(): void;
data: IUVData;
dependenciesLoaded(...args: any[]): void;
dependencyLoaded(index: number, dep: any): void;
exitFullScreen(): void;
Expand All @@ -33,12 +33,12 @@ export interface IExtension {
helper: Manifold.IHelper;
isCreated: boolean;
isDeepLinkingEnabled(): boolean;
isDesktopMetric(): boolean;
isFooterPanelEnabled(): boolean;
isFullScreen(): boolean;
isHeaderPanelEnabled(): boolean;
isLeftPanelEnabled(): boolean;
isLoggedIn: boolean;
isMobileMetric(): boolean;
isOverlayActive(): boolean;
isRightPanelEnabled(): boolean;
isSeeAlsoEnabled(): boolean;
Expand Down
1 change: 1 addition & 0 deletions src/modules/uv-shared-module/MetricType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export class MetricType extends StringValue {
public static MOBILEPORTRAIT = new MetricType("mobileportrait");
public static MOBILELANDSCAPE = new MetricType("mobilelandscape");
public static LAPTOP = new MetricType("laptop");
public static NONE = new MetricType("none");
}
2 changes: 1 addition & 1 deletion src/modules/uv-shared-module/Shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Shell extends BaseView {
Shell.$footerPanel = $('<div class="footerPanel"></div>');
Shell.$element.append(Shell.$footerPanel);

Shell.$mobileFooterPanel = $('<div class="footerPanel mobile"></div>');
Shell.$mobileFooterPanel = $('<div class="mobileFooterPanel"></div>');
Shell.$element.append(Shell.$mobileFooterPanel);

Shell.$overlays = $('<div class="overlays"></div>');
Expand Down
71 changes: 61 additions & 10 deletions src/modules/uv-shared-module/css/catch-all.less
Original file line number Diff line number Diff line change
@@ -1,18 +1,69 @@
.headerPanel {
display: none;
}
.uv {

.mainPanel {

.leftPanel {
.headerPanel {
display: none;
}

.rightPanel {
.mainPanel {

.leftPanel {
display: none;
}

.rightPanel {
display: none;
}
}

.footerPanel {
display: none;
}
}

.footerPanel {
display: none;
.mobileFooterPanel {

display: block;
position: relative;
height: 50px;

.options {

position: absolute;
width: 315px;
height: 42px;

.spacer {
float: left;
width: 30px;
height: 41px;
}

.btn {

margin-right: @margin-small-horizontal;

color: white;
font-size: 0;

&.bookmark {
display: none;
}

&.open {
display: none;
}

&.feedback {
display: none;
}

&.embed {
display: none;
}

&.fullScreen {
display: none;
}
}
}
}
}
12 changes: 6 additions & 6 deletions src/modules/uv-shared-module/css/footer-panel.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
height: 42px;

.btn {
color: white;
font-size: 0;
color: white;
font-size: 0;

&.fullScreen,
&.exitFullscreen {
float: right;
}
&.fullScreen,
&.exitFullscreen {
float: right;
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/modules/uv-shared-module/css/laptop.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@

.footerPanel {
display: block;

.moreInfo {
display: none;
}
}

.mobileFooterPanel {
display: none;
}
}
}
Loading

0 comments on commit 28b5b21

Please sign in to comment.