Skip to content
Snippets Groups Projects
Commit 807d42da authored by Jack Reed's avatar Jack Reed Committed by Chris Beer
Browse files

Make OpenSeaDragon configurable from the settings fixes #1330

parent e7a3c956
Branches
Tags
No related merge requests found
...@@ -56,19 +56,14 @@ export class OpenSeadragonViewer extends Component { ...@@ -56,19 +56,14 @@ export class OpenSeadragonViewer extends Component {
* React lifecycle event * React lifecycle event
*/ */
componentDidMount() { componentDidMount() {
const { viewer } = this.props; const { osdConfig, viewer } = this.props;
if (!this.ref.current) { if (!this.ref.current) {
return; return;
} }
this.viewer = new OpenSeadragon({ this.viewer = new OpenSeadragon({
alwaysBlend: false,
blendTime: 0.1,
id: this.ref.current.id, id: this.ref.current.id,
preserveImageSizeOnResize: true, ...osdConfig,
preserveViewport: true,
showNavigationControl: false,
}); });
this.osdCanvasOverlay = new OpenSeadragonCanvasOverlay(this.viewer); this.osdCanvasOverlay = new OpenSeadragonCanvasOverlay(this.viewer);
...@@ -327,6 +322,7 @@ OpenSeadragonViewer.defaultProps = { ...@@ -327,6 +322,7 @@ OpenSeadragonViewer.defaultProps = {
children: null, children: null,
highlightedAnnotations: [], highlightedAnnotations: [],
label: null, label: null,
osdConfig: {},
palette: {}, palette: {},
searchAnnotations: [], searchAnnotations: [],
selectedAnnotations: [], selectedAnnotations: [],
...@@ -341,6 +337,7 @@ OpenSeadragonViewer.propTypes = { ...@@ -341,6 +337,7 @@ OpenSeadragonViewer.propTypes = {
classes: PropTypes.objectOf(PropTypes.string).isRequired, classes: PropTypes.objectOf(PropTypes.string).isRequired,
highlightedAnnotations: PropTypes.arrayOf(PropTypes.object), highlightedAnnotations: PropTypes.arrayOf(PropTypes.object),
label: PropTypes.string, label: PropTypes.string,
osdConfig: PropTypes.object, // eslint-disable-line react/forbid-prop-types
palette: PropTypes.object, // eslint-disable-line react/forbid-prop-types palette: PropTypes.object, // eslint-disable-line react/forbid-prop-types
searchAnnotations: PropTypes.arrayOf(PropTypes.object), searchAnnotations: PropTypes.arrayOf(PropTypes.object),
selectedAnnotations: PropTypes.arrayOf(PropTypes.object), selectedAnnotations: PropTypes.arrayOf(PropTypes.object),
......
...@@ -268,5 +268,12 @@ export default { ...@@ -268,5 +268,12 @@ export default {
galleryView: { galleryView: {
height: 120, // height of gallery view thumbnails height: 120, // height of gallery view thumbnails
width: null, // width of gallery view thumbnails (or null, to auto-calculate an aspect-ratio appropriate size) width: null, // width of gallery view thumbnails (or null, to auto-calculate an aspect-ratio appropriate size)
},
osdConfig: { // Default config used for OpenSeadragon
alwaysBlend: false,
blendTime: 0.1,
preserveImageSizeOnResize: true,
preserveViewport: true,
showNavigationControl: false,
} }
}; };
...@@ -34,6 +34,7 @@ const mapStateToProps = (state, { companionWindowId, windowId }) => ({ ...@@ -34,6 +34,7 @@ const mapStateToProps = (state, { companionWindowId, windowId }) => ({
canvasId: (getCurrentCanvas(state, { windowId }) || {}).id, canvasId: (getCurrentCanvas(state, { windowId }) || {}).id,
windowId, windowId,
}), }),
osdConfig: state.config.osdConfig,
palette: getTheme(state).palette, palette: getTheme(state).palette,
searchAnnotations: getSearchAnnotationsForWindow( searchAnnotations: getSearchAnnotationsForWindow(
state, state,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment