Skip to content
Snippets Groups Projects
Select Git revision
  • 903a1dfdd28c85c75e5f562ba8e8890ce34fd3e0
  • 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

WindowSideBarCanvasPanel.js

Blame
  • WindowCanvasNavigationControls.js 1.97 KiB
    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import classNames from 'classnames';
    import Paper from '@material-ui/core/Paper';
    import Typography from '@material-ui/core/Typography';
    import ZoomControls from '../containers/ZoomControls';
    import ViewerInfo from '../containers/ViewerInfo';
    import ViewerNavigation from '../containers/ViewerNavigation';
    import ns from '../config/css-ns';
    
    /**
     * Represents the viewer controls in the mirador workspace.
     */
    export class WindowCanvasNavigationControls extends Component {
      /**
       * Determine if canvasNavControls are stacked (based on a hard-coded width)
      */
      canvasNavControlsAreStacked() {
        const { size } = this.props;
    
        return (size && size.width && size.width <= 253);
      }
    
      /** */
      render() {
        const {
          classes, visible, windowId, zoomToWorld,
        } = this.props;
    
        if (!visible) return (<Typography variant="srOnly" component="div"><ViewerInfo windowId={windowId} /></Typography>);
    
        return (
          <Paper
            square
            className={
              classNames(
                classes.controls,
                ns('canvas-nav'),
                classes.canvasNav,
                this.canvasNavControlsAreStacked() ? ns('canvas-nav-stacked') : null,
                this.canvasNavControlsAreStacked() ? classes.canvasNavStacked : null,
              )}
            elevation={0}
          >
            <ZoomControls
              displayDivider={!this.canvasNavControlsAreStacked()}
              windowId={windowId}
              zoomToWorld={zoomToWorld}
            />
            <ViewerNavigation windowId={windowId} />
            <ViewerInfo windowId={windowId} />
          </Paper>
        );
      }
    }
    
    
    WindowCanvasNavigationControls.propTypes = {
      classes: PropTypes.objectOf(PropTypes.string),
      size: PropTypes.shape({ width: PropTypes.number }).isRequired,
      visible: PropTypes.bool,
      windowId: PropTypes.string.isRequired,
      zoomToWorld: PropTypes.func.isRequired,
    };
    
    WindowCanvasNavigationControls.defaultProps = {
      classes: {},
      visible: true,
    };