Skip to content
Snippets Groups Projects
Select Git revision
  • 7957dab88bede3ec401438426d4a06f63d924749
  • master default protected
2 results

browserslist

Blame
  • AnnotationCreation.js 11.31 KiB
    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import Button from '@material-ui/core/Button';
    import Typography from '@material-ui/core/Typography';
    import Paper from '@material-ui/core/Paper';
    import Grid from '@material-ui/core/Grid';
    import ToggleButton from '@material-ui/lab/ToggleButton';
    import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
    import RectangleIcon from '@material-ui/icons/CheckBoxOutlineBlank';
    import CircleIcon from '@material-ui/icons/RadioButtonUnchecked';
    import PolygonIcon from '@material-ui/icons/Timeline';
    import FormatColorFillIcon from '@material-ui/icons/FormatColorFill';
    import StrokeColorIcon from '@material-ui/icons/BorderColor';
    import LineWeightIcon from '@material-ui/icons/LineWeight';
    import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
    import FormatShapesIcon from '@material-ui/icons/FormatShapes';
    import Popover from '@material-ui/core/Popover';
    import Divider from '@material-ui/core/Divider';
    import MenuItem from '@material-ui/core/MenuItem';
    import ClickAwayListener from '@material-ui/core/ClickAwayListener';
    import MenuList from '@material-ui/core/MenuList';
    import { SketchPicker } from 'react-color';
    import { v4 as uuid } from 'uuid';
    import { withStyles } from '@material-ui/core/styles';
    import AnnotationDrawing from './AnnotationDrawing';
    import TextEditor from './TextEditor';
    import WebAnnotation from './WebAnnotation';
    import CursorIcon from './icons/Cursor';
    
    /** */
    class AnnotationCreation extends Component {
      /** */
      constructor(props) {
        super(props);
        const annoState = {};
        if (props.annotation) {
          annoState.annoBody = props.annotation.body.value;
          annoState.svg = props.annotation.target.selector.value;
        }
        this.state = {
          activeTool: 'cursor',
          annoBody: '',
          colorPopoverOpen: false,
          currentColorType: false,
          fillColor: null,
          lineWeightPopoverOpen: false,
          popoverAnchorEl: null,
          popoverLineWeightAnchorEl: null,
          strokeColor: '#00BFFF',
          strokeWidth: 1,
          svg: null,
          xywh: null,
          ...annoState,
        };
    
        this.submitForm = this.submitForm.bind(this);
        this.updateBody = this.updateBody.bind(this);
        this.updateGeometry = this.updateGeometry.bind(this);
        this.changeTool = this.changeTool.bind(this);
        this.openChooseColor = this.openChooseColor.bind(this);
        this.openChooseLineWeight = this.openChooseLineWeight.bind(this);
        this.handleLineWeightSelect = this.handleLineWeightSelect.bind(this);
        this.handleCloseLineWeight = this.handleCloseLineWeight.bind(this);
        this.closeChooseColor = this.closeChooseColor.bind(this);
        this.updateStrokeColor = this.updateStrokeColor.bind(this);
      }
    
      /** */
      openChooseColor(e) {
        this.setState({