From 8b0e863c58c46b39fa01b31b33f7a9231d032ff5 Mon Sep 17 00:00:00 2001 From: jamesmisson Date: Fri, 27 Nov 2026 10:07:09 +0000 Subject: [PATCH 01/13] add icons for contrast, rotate, zoom in, zoom out --- .../iiif/modules/uv-shared-module/Icons.tsx | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx b/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx index a25c1f517..a16ec27eb 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx +++ b/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx @@ -54,6 +54,31 @@ export const CollapseLeftPanel: React.FC = ({ ); +export const Contrast: React.FC = ({ + className = "", + width = 30, + height = 30, + style = {}, +}) => ( + + + + + +); + export const ExpandRightPanel: React.FC = ({ className = "", width = 30, @@ -141,6 +166,31 @@ export const OneUp: React.FC = ({ ); +export const Rotate: React.FC = ({ + className = "", + width = 30, + height = 30, + style = {}, +}) => ( + + + + + +); + export const Settings: React.FC = ({ className = "", width = 30, @@ -193,3 +243,39 @@ export const TwoUp: React.FC = ({ ); + +export const ZoomIn: React.FC = ({ + className = "", + width = 30, + height = 30, + style = {}, +}) => ( + + + +); + +export const ZoomOut: React.FC = ({ + className = "", + width = 30, + height = 30, + style = {}, +}) => ( + + + +); From d1da866d94dabc72c16c7b1942f88dc8aec2a9bd Mon Sep 17 00:00:00 2001 From: jamesmisson Date: Fri, 27 Nov 2026 10:20:26 +0000 Subject: [PATCH 02/13] add icons for Layers, FitImage --- .../iiif/modules/uv-shared-module/Icons.tsx | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx b/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx index a16ec27eb..f6f4d79bd 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx +++ b/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx @@ -8,6 +8,28 @@ interface IconProps { style?: React.CSSProperties; } +export const Choice: React.FC = ({ + className = "", + width = 30, + height = 30, + style = {}, +}) => ( + +); + export const CollapseRightPanel: React.FC = ({ className = "", width = 30, @@ -123,6 +145,26 @@ export const ExpandLeftPanel: React.FC = ({ ); +export const FitImage: React.FC = ({ + className = "", + width = 30, + height = 30, + style = {}, +}) => ( + +); + export const Gallery: React.FC = ({ className = "", width = 30, From 10b24564ccf52471c243df6a42cc4c96bf90d1d5 Mon Sep 17 00:00:00 2001 From: jamesmisson Date: Fri, 27 Nov 2026 10:30:30 +0000 Subject: [PATCH 03/13] add ImageControls component --- .../ImageControls.tsx | 104 ++++++++++++++++++ .../iiif/modules/uv-shared-module/Icons.tsx | 52 ++++----- 2 files changed, 130 insertions(+), 26 deletions(-) create mode 100644 src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/ImageControls.tsx diff --git a/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/ImageControls.tsx b/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/ImageControls.tsx new file mode 100644 index 000000000..54fc32cca --- /dev/null +++ b/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/ImageControls.tsx @@ -0,0 +1,104 @@ +import React from "react"; +import Button from "../uv-shared-module/Button"; +import { IIIFEvents } from "../../IIIFEvents"; +import { IIIFExtensionHost } from "../../IIIFExtensionHost"; +import { OpenSeadragonExtensionEvents } from "../../extensions/uv-openseadragon-extension/Events"; +import { Config } from "../../extensions/uv-openseadragon-extension/config/Config"; +import { + AdjustImage, + FitImage, + Layers, + Rotate, + ZoomIn, + ZoomOut, +} from "../uv-shared-module/Icons"; + +type CenterPanelConfig = Config["modules"]["openSeadragonCenterPanel"]; + +interface Props { + extensionHost: IIIFExtensionHost; + content: CenterPanelConfig["content"]; + showHomeButton: boolean; + showAdjustImageButton: boolean; + hasChoices: boolean; +} + +const ImageControls: React.FC = ({ + extensionHost, + content, + showHomeButton, + showAdjustImageButton, + hasChoices, +}) => { + return ( + <> + + + + + + + {showHomeButton && ( + + )} + + {showAdjustImageButton && ( + + )} + + {hasChoices && ( + + )} + + ); +}; + +export default ImageControls; diff --git a/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx b/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx index f6f4d79bd..4cb57ae36 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx +++ b/src/content-handlers/iiif/modules/uv-shared-module/Icons.tsx @@ -8,7 +8,7 @@ interface IconProps { style?: React.CSSProperties; } -export const Choice: React.FC = ({ +export const AdjustImage: React.FC = ({ className = "", width = 30, height = 30, @@ -21,11 +21,14 @@ export const Choice: React.FC = ({ xmlns="http://www.w3.org/2000/svg" className={className} style={style} - aria-hidden="true" - focusable="false" > - - + + ); @@ -76,10 +79,11 @@ export const CollapseLeftPanel: React.FC = ({ ); -export const Contrast: React.FC = ({ +export const ExpandRightPanel: React.FC = ({ className = "", width = 30, height = 30, + fill = "currentColor", style = {}, }) => ( = ({ xmlns="http://www.w3.org/2000/svg" className={className} style={style} + aria-hidden="true" + focusable="false" > - - - + + + ); -export const ExpandRightPanel: React.FC = ({ +export const ExpandLeftPanel: React.FC = ({ className = "", width = 30, height = 30, @@ -118,17 +119,14 @@ export const ExpandRightPanel: React.FC = ({ aria-hidden="true" focusable="false" > - - - + ); -export const ExpandLeftPanel: React.FC = ({ +export const FitImage: React.FC = ({ className = "", width = 30, height = 30, - fill = "currentColor", style = {}, }) => ( = ({ aria-hidden="true" focusable="false" > - + ); -export const FitImage: React.FC = ({ +export const Gallery: React.FC = ({ className = "", width = 30, height = 30, + fill = "currentColor", style = {}, }) => ( = ({ aria-hidden="true" focusable="false" > - + ); -export const Gallery: React.FC = ({ +export const Layers: React.FC = ({ className = "", width = 30, height = 30, - fill = "currentColor", style = {}, }) => ( = ({ aria-hidden="true" focusable="false" > - + + + ); From adcc371287de6e54a117d219b8580577da6aee96 Mon Sep 17 00:00:00 2001 From: jamesmisson Date: Fri, 27 Nov 2026 10:49:12 +0000 Subject: [PATCH 04/13] render ImageControls component in OpenSeadragonCenterPanel; add workaround for choice and image adjust dialogues --- .../OpenSeadragonCenterPanel.ts | 189 +++--------------- .../css/styles.less | 3 +- 2 files changed, 34 insertions(+), 158 deletions(-) diff --git a/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/OpenSeadragonCenterPanel.ts b/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/OpenSeadragonCenterPanel.ts index d48ffa31f..2a7a54cc3 100644 --- a/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/OpenSeadragonCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/OpenSeadragonCenterPanel.ts @@ -7,6 +7,10 @@ import { CenterPanel } from "../uv-shared-module/CenterPanel"; import { OpenSeadragonExtensionEvents } from "../../extensions/uv-openseadragon-extension/Events"; import { Config } from "../../extensions/uv-openseadragon-extension/config/Config"; +import { createElement } from "react"; +import { createRoot, Root } from "react-dom/client"; +import ImageControls from "./ImageControls"; + export class OpenSeadragonCenterPanel extends CenterPanel< Config["modules"]["openSeadragonCenterPanel"] > { @@ -18,18 +22,26 @@ export class OpenSeadragonCenterPanel extends CenterPanel< showAdjustImageButton: boolean; showHomeButton: boolean; - $goHomeButton: JQuery; $nextButton: JQuery; $prevButton: JQuery; - $rotateButton: JQuery; - $zoomInButton: JQuery; - $zoomOutButton: JQuery; - $adjustImageButton: JQuery; - $choiceSwitchButton: JQuery; $navigator: JQuery; $imageControlsContainer: JQuery; + imageControlsRoot: Root; + hasChoices: boolean = false; + + // The AdjustImageDialogue and ChoiceSwitchDialogue position themselves against the old jquery buttons, + // so these getters allow them access - but ultimately the dialogues should be redesigned and become part of the ImageControls react component, + // then we can remove this workaround. + get $adjustImageButton(): JQuery { + return this.$imageControlsContainer.find(".adjustImage"); + } + + get $choiceSwitchButton(): JQuery { + return this.$imageControlsContainer.find(".choiceSwitch"); + } + constructor($element: JQuery) { super($element); } @@ -103,151 +115,22 @@ export class OpenSeadragonCenterPanel extends CenterPanel< '
' ); this.$content.prepend(this.$imageControlsContainer); - - this.$zoomInButton = $(" - - {showHomeButton && ( )} + + {showAdjustImageButton && (