Skip to content

Commit

Permalink
Image adjustment and fix to "Home Button" (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
ra-anders authored Oct 16, 2024
1 parent c0fda72 commit 1f76880
Show file tree
Hide file tree
Showing 26 changed files with 1,185 additions and 647 deletions.
17 changes: 17 additions & 0 deletions src/content-handlers/iiif/BaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,22 @@ type AuthDialogue = ModuleConfig & {
content: AuthDialogueContent;
};

type AdjustImageDialogueOptions = DialogueOptions & {};

type AdjustImageDialogueContent = DialogueContent & {
title: string;
brightness: string;
contrast: string;
saturation: string;
reset: string;
remember: string;
}

export type AdjustImageDialogue = ModuleConfig & {
options: AdjustImageDialogueOptions;
content: AdjustImageDialogueContent;
}

export type DownloadDialogueOptions = DialogueOptions & {};

export type DownloadDialogueContent = DialogueContent & {
Expand Down Expand Up @@ -439,6 +455,7 @@ export type BaseConfig = {
restrictedDialogue: RestrictedDialogue;
settingsDialogue: SettingsDialogue;
shareDialogue: ShareDialogue;
adjustImageDialogue: AdjustImageDialogue;
};
localisation: Localisation;
content: Content;
Expand Down
2 changes: 2 additions & 0 deletions src/content-handlers/iiif/IIIFEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,6 @@ export class IIIFEvents {
static UPDATE_SETTINGS: string = "updateSettings";
static VIEW_FULL_TERMS: string = "viewFullTerms";
static WINDOW_UNLOAD: string = "windowUnload";
static SHOW_ADJUSTIMAGE_DIALOGUE: string = "showAdjustImageDialogue";
static HIDE_ADJUSTIMAGE_DIALOGUE: string = "hideAdjustImageDialogue";
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,20 @@
"confirm": "$confirm"
}
},
"adjustImageDialogue": {
"options": {
"topCloseButtonEnabled": false
},
"content": {
"title": "$adjustImage",
"brightness": "$brightness",
"contrast": "$contrast",
"saturation": "$saturation",
"close": "$close",
"reset": "$reset",
"remember": "$remember"
}
},
"clickThroughDialogue": {
"options": {
"topCloseButtonEnabled": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,20 @@
"confirm": "$confirm"
}
},
"adjustImageDialogue": {
"options": {
"topCloseButtonEnabled": false
},
"content": {
"title": "$adjustImage",
"brightness": "$brightness",
"contrast": "$contrast",
"saturation": "$saturation",
"close": "$close",
"reset": "$reset",
"remember": "$remember"
}
},
"clickThroughDialogue": {
"options": {
"topCloseButtonEnabled": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,20 @@
"confirm": "$confirm"
}
},
"adjustImageDialogue": {
"options": {
"topCloseButtonEnabled": false
},
"content": {
"title": "$adjustImage",
"brightness": "$brightness",
"contrast": "$contrast",
"saturation": "$saturation",
"close": "$close",
"reset": "$reset",
"remember": "$remember"
}
},
"clickThroughDialogue": {
"options": {
"topCloseButtonEnabled": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,20 @@
"confirm": "$confirm"
}
},
"adjustImageDialogue": {
"options": {
"topCloseButtonEnabled": false
},
"content": {
"title": "$adjustImage",
"brightness": "$brightness",
"contrast": "$contrast",
"saturation": "$saturation",
"close": "$close",
"reset": "$reset",
"remember": "$remember"
}
},
"clickThroughDialogue": {
"options": {
"topCloseButtonEnabled": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@
"confirm": "$confirm"
}
},
"adjustImageDialogue": {
"options": {
"topCloseButtonEnabled": false
},
"content": {
"title": "$adjustImage",
"brightness": "$brightness",
"contrast": "$contrast",
"saturation": "$saturation",
"close": "$close",
"reset": "$reset",
"remember": "$remember"
}
},
"clickThroughDialogue": {
"options": {
"topCloseButtonEnabled": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,20 @@
"title": "$settings",
"website": "$uvWebsite"
}
},
"adjustImageDialogue": {
"options": {
"topCloseButtonEnabled": false
},
"content": {
"title": "$adjustImage",
"brightness": "$brightness",
"contrast": "$contrast",
"saturation": "$saturation",
"close": "$close",
"reset": "$reset",
"remember": "$remember"
}
}
},
"localisation": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { AdjustImageDialogue as BaseAdjustImageDialogue } from "../../modules/uv-dialogues-module/AdjustImageDialogue";
import { Shell } from "../../modules/uv-shared-module/Shell";

export class AdjustImageDialogue extends BaseAdjustImageDialogue {
constructor($element: JQuery, shell: Shell) {
super($element, shell);
}

create(): void {
this.setConfig("shareDialogue");
super.create();
}

resize(): void {
super.resize();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { createStore, OpenSeadragonExtensionState } from "./Store";
import { merge } from "../../../../Utils";
import defaultConfig from "./config/config.json";
import { Config } from "./config/Config";
import { AdjustImageDialogue } from "../../modules/uv-dialogues-module/AdjustImageDialogue";

export default class OpenSeadragonExtension extends BaseExtension<Config> {
$downloadDialogue: JQuery;
Expand All @@ -63,6 +64,7 @@ export default class OpenSeadragonExtension extends BaseExtension<Config> {
$multiSelectDialogue: JQuery;
$settingsDialogue: JQuery;
$shareDialogue: JQuery;
$adjustImageDialogue: JQuery;
centerPanel: OpenSeadragonCenterPanel;
currentAnnotationRect: AnnotationRect | null;
currentRotation: number = 0;
Expand All @@ -71,6 +73,7 @@ export default class OpenSeadragonExtension extends BaseExtension<Config> {
footerPanel: FooterPanel;
headerPanel: PagingHeaderPanel;
helpDialogue: HelpDialogue;
adjustImageDialogue: AdjustImageDialogue;
isAnnotating: boolean = false;
leftPanel: ContentLeftPanel;
mobileFooterPanel: MobileFooterPanel;
Expand Down Expand Up @@ -567,6 +570,12 @@ export default class OpenSeadragonExtension extends BaseExtension<Config> {
this.shell.$overlays.append(this.$shareDialogue);
this.shareDialogue = new ShareDialogue(this.$shareDialogue);

this.$adjustImageDialogue = $(
'<div class="overlay adjustImage" aria-hidden="true"></div>'
);
this.shell.$overlays.append(this.$adjustImageDialogue);
this.adjustImageDialogue = new AdjustImageDialogue(this.$adjustImageDialogue, this.shell);

this.$downloadDialogue = $("<div></div>");
this.shell.$overlays.append(this.$downloadDialogue);
this.downloadDialogueRoot = createRoot(this.$downloadDialogue[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ interface ISettings {
preserveViewport?: boolean;
clickToZoomEnabled?: boolean;
reducedAnimation?: boolean;
contrastPercent?: number;
brightnessPercent?: number;
saturationPercent?: number;
rememberSettings?: boolean;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
AdjustImageDialogue,
BaseConfig,
CenterPanelContent,
CenterPanelOptions,
Expand Down Expand Up @@ -126,6 +127,8 @@ type OpenSeadragonCenterPanelOptions = CenterPanelOptions & {
pageGap: number;
/** Determines if home control is shown */
showHomeControl: boolean;
/** Determines if adjust image control is shown */
showAdjustImageControl: boolean;
/** Number of attributions to trim */
trimAttributionCount: number;
/** Ratio of visibility */
Expand All @@ -141,6 +144,7 @@ type OpenSeadragonCenterPanelContent = CenterPanelContent & {
rotateRight: string;
zoomIn: string;
zoomOut: string;
adjustImage: string;
};

type OpenSeadragonCenterPanel = ModuleConfig & {
Expand Down Expand Up @@ -279,6 +283,7 @@ type Modules = {
mobileFooterPanel: MobileFooterPanel;
shareDialogue: OSDShareDialogue;
settingsDialogue: OSDSettingsDialogue;
adjustImageDialogue: AdjustImageDialogue
};

export type Config = BaseConfig & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
"pageGap": 50,
"requiredStatementEnabled": true,
"showHomeControl": false,
"showAdjustImageControl": true,
"subtitleEnabled": true,
"titleEnabled": true,
"trimAttributionCount": 150,
Expand All @@ -369,7 +370,8 @@
"previous": "$previous",
"rotateRight": "$rotateRight",
"zoomIn": "$zoomIn",
"zoomOut": "$zoomOut"
"zoomOut": "$zoomOut",
"adjustImage": "$adjustImage"
}
},
"searchFooterPanel": {
Expand Down Expand Up @@ -469,6 +471,20 @@
"close": "$close"
}
},
"adjustImageDialogue": {
"options": {
"topCloseButtonEnabled": false
},
"content": {
"title": "$adjustImage",
"brightness": "$brightness",
"contrast": "$contrast",
"saturation": "$saturation",
"close": "$close",
"reset": "$reset",
"remember": "$remember"
}
},
"clickThroughDialogue": {
"options": {
"topCloseButtonEnabled": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@
"title": "$help"
}
},
"adjustImageDialogue": {
"options": {
"topCloseButtonEnabled": false
},
"content": {
"title": "$adjustImage",
"brightness": "$brightness",
"contrast": "$contrast",
"saturation": "$saturation",
"close": "$close",
"reset": "$reset",
"remember": "$remember"
}
},
"moreInfoRightPanel": {
"options": {
"canvasDisplayOrder": "",
Expand Down
Loading

0 comments on commit 1f76880

Please sign in to comment.