Skip to content
Snippets Groups Projects
Select Git revision
  • cb29f9be07be9473628afb499dd17349b4bfeb8f
  • mui5-annotation-on-video-stable default
  • get_setter_canvasSizeInformations
  • fix-error-div-into-p
  • annotation-on-video-v2
  • detached
  • annotation-on-video-r17
  • mui5
  • mui5-react-18
  • jacob-test
  • annotation-on-video protected
  • master
  • test-antoinev1
  • 20-fetch-thumbnail-on-annotation
  • add-research-field
  • Save
  • add-plugin
  • 14-wip-no-seek-to
  • 14-bug-on-video-time-control
  • 9_wip_videotests
  • _upgrade_material_ui
  • latest-tetras-16
  • v3.3.0
  • v3.2.0
  • v3.1.1
  • v3.1.0
  • v3.0.0
  • v3.0.0-rc.7
  • v3.0.0-rc.6
  • v3.0.0-rc.5
  • v3.0.0-rc.4
  • v3.0.0-rc.3
  • v3.0.0-rc.2
  • v3.0.0-rc.1
  • v3.0.0-beta.10
  • v3.0.0-beta.9
  • v3.0.0-beta.8
  • v3.0.0-beta.7
  • v3.0.0-beta.6
  • v3.0.0-beta.5
  • v3.0.0-beta.3
41 results

setupJest.js

Blame
  • WorkspaceElastic.js 2.45 KiB
    import React from 'react';
    import PropTypes from 'prop-types';
    import { Rnd } from 'react-rnd';
    import Window from '../containers/Window';
    import ns from '../config/css-ns';
    
    /**
     * Represents a work area that contains any number of windows
     * @memberof Workspace
     * @private
     */
    class WorkspaceElastic extends React.Component {
      /**
       */
      render() {
        const {
          workspace,
          windows,
          setWorkspaceViewportPosition,
          updateWindowPosition,
          setWindowSize,
        } = this.props;
        return (
          <Rnd
            default={{
              width: 5000,
              height: 5000,
            }}
            position={{ x: workspace.viewportPosition.x, y: workspace.viewportPosition.y }}
            enableResizing={{
              top: false,
              right: false,
              bottom: false,
              left: false,
              topRight: false,
              bottomRight: false,
              bottomLeft: false,
              topLeft: false,
            }}
            onDragStop={(e, d) => {
              setWorkspaceViewportPosition({ x: d.x, y: d.y });
            }}
            cancel={`.${ns('window')}`}
            className={ns('workspace')}
          >
            {
              Object.values(windows).map(window => (
                <Rnd
                  key={window.id}
                  size={{ width: window.width, height: window.height }}
                  position={{ x: window.x, y: window.y }}
                  bounds="parent"
                  onDragStop={(e, d) => {
                    updateWindowPosition(window.id, { x: d.x, y: d.y });
                  }}
                  onResize={(e, direction, ref, delta, position) => {
                    setWindowSize(window.id, {
                      width: ref.style.width,
                      height: ref.style.height,
                      ...position,
                    });
                  }}
                  dragHandleClassName={ns('window-top-bar')}
                  className={
                    workspace.focusedWindowId === window.id ? ns('workspace-focused-window') : null
                  }
                >
                  <Window
                    window={window}
                  />
                </Rnd>
              ))
            }
          </Rnd>
        );
      }
    }
    
    WorkspaceElastic.propTypes = {
      setWorkspaceViewportPosition: PropTypes.func.isRequired,
      windows: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
      workspace: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
      updateWindowPosition: PropTypes.func.isRequired,
      setWindowSize: PropTypes.func.isRequired,
    };
    
    export default WorkspaceElastic;