mirador
Version:
An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.
36 lines (31 loc) • 900 B
JavaScript
import { compose } from 'redux';
import { connect } from 'react-redux';
import { withPlugins } from '../extend/withPlugins';
import { ViewerInfo } from '../components/ViewerInfo';
import {
getCanvasLabel, getCanvases, getCanvasIndex, getCurrentCanvas,
} from '../state/selectors';
/**
* mapStateToProps - to hook up connect
* @memberof Window
* @private
*/
const mapStateToProps = (state, props) => {
const { windowId } = props;
const canvases = getCanvases(state, { windowId });
const canvasIndex = getCanvasIndex(state, { windowId });
const canvasId = (getCurrentCanvas(state, { windowId }) || {}).id;
return {
canvasCount: canvases.length,
canvasIndex,
canvasLabel: getCanvasLabel(state, {
canvasId,
windowId,
}),
};
};
const enhance = compose(
connect(mapStateToProps, null),
withPlugins('ViewerInfo'),
);
export default enhance(ViewerInfo);