Skip to content
Snippets Groups Projects
Select Git revision
  • 5c97cfe961aab7176386630b3012f12af8ee4741
  • annotation-on-video default protected
  • demo_ci
  • 3-upstream-01022023
  • master
  • gh3538-captions
  • 16-adapt-for-images-annot
  • 15-api-for-annotations-on-video
  • 15-annotations-on-videos
  • video_for_annotations
  • wip-1-annotations-on-videos
  • 9-videoviewer-tests
  • 9_wip_videotests
  • 6-fix-tests-and-ci
  • _fix_ci
  • wip-webpack-from-git
16 results

CanvasAnnotations.test.js

Blame
  • OpenSeadragonViewer.js 1.55 KiB
    import { compose } from 'redux';
    import { connect } from 'react-redux';
    import { withTranslation } from 'react-i18next';
    import { withStyles } from '@material-ui/core';
    import { fade } from '@material-ui/core/styles/colorManipulator';
    import { OpenSeadragonViewer } from '../components/OpenSeadragonViewer';
    import * as actions from '../state/actions';
    import {
      getCanvasLabel,
      getSelectedCanvas,
      getSelectedCanvasAnnotations,
    } from '../state/selectors';
    
    /**
     * mapStateToProps - used to hook up connect to action creators
     * @memberof Window
     * @private
     */
    const mapStateToProps = ({
      viewers, windows, manifests, annotations,
    }, { windowId, currentCanvases }) => ({
      viewer: viewers[windowId],
      label: getCanvasLabel(
        getSelectedCanvas({ windows, manifests }, windowId),
        windows[windowId].canvasIndex,
      ),
      annotations: getSelectedCanvasAnnotations(
        { annotations },
        currentCanvases.map(canvas => canvas.id),
      ),
    });
    
    /**
     * mapDispatchToProps - used to hook up connect to action creators
     * @memberof ManifestListItem
     * @private
     */
    const mapDispatchToProps = {
      updateViewport: actions.updateViewport,
    };
    
    /**
     *
     * @param theme
     * @returns {{windowSideBarHeading: *}}
     */
    const styles = theme => ({
      controls: {
        width: '100%',
        position: 'absolute',
        bottom: 0,
        zIndex: 50,
        backgroundColor: fade(theme.palette.background.paper, 0.5),
      },
    });
    
    const enhance = compose(
      withStyles(styles),
      withTranslation(),
      connect(mapStateToProps, mapDispatchToProps),
      // further HOC go here
    );
    
    
    export default enhance(OpenSeadragonViewer);