"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.Protractor = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _styles = require("@material-ui/core/styles");

var _propTypes = _interopRequireDefault(require("prop-types"));

var _graphic = _interopRequireDefault(require("./graphic"));

var _anchor = _interopRequireDefault(require("../anchor"));

var _rotatable = _interopRequireDefault(require("../rotatable"));

var _classnames = _interopRequireDefault(require("classnames"));

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

var Protractor = /*#__PURE__*/function (_React$Component) {
  (0, _inherits2["default"])(Protractor, _React$Component);

  var _super = _createSuper(Protractor);

  function Protractor() {
    (0, _classCallCheck2["default"])(this, Protractor);
    return _super.apply(this, arguments);
  }

  (0, _createClass2["default"])(Protractor, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          classes = _this$props.classes,
          width = _this$props.width,
          className = _this$props.className,
          startPosition = _this$props.startPosition;
      return /*#__PURE__*/_react["default"].createElement(_rotatable["default"], {
        className: className,
        startPosition: startPosition,
        handle: [{
          "class": 'leftAnchor',
          origin: "".concat(width * 0.495, "px ").concat(width * 0.49, "px")
        }, {
          "class": 'rightAnchor',
          origin: "".concat(width * 0.495, "px ").concat(width * 0.49, "px")
        }]
      }, /*#__PURE__*/_react["default"].createElement("div", {
        className: classes.protractor,
        style: {
          width: "".concat(width, "px")
        }
      }, /*#__PURE__*/_react["default"].createElement(_graphic["default"], null), /*#__PURE__*/_react["default"].createElement(_anchor["default"], {
        className: (0, _classnames["default"])('leftAnchor', classes.leftAnchor)
      }), /*#__PURE__*/_react["default"].createElement(_anchor["default"], {
        className: (0, _classnames["default"])('rightAnchor', classes.rightAnchor)
      })));
    }
  }]);
  return Protractor;
}(_react["default"].Component);

exports.Protractor = Protractor;
(0, _defineProperty2["default"])(Protractor, "propTypes", {
  classes: _propTypes["default"].object.isRequired,
  width: _propTypes["default"].number.isRequired,
  className: _propTypes["default"].string,
  startPosition: _propTypes["default"].shape({
    left: _propTypes["default"].number,
    top: _propTypes["default"].number
  })
});
(0, _defineProperty2["default"])(Protractor, "defaultProps", {
  width: 450,
  startPosition: {
    left: 0,
    top: 0
  }
});

var _default = (0, _styles.withStyles)(function () {
  return {
    protractor: {
      position: 'relative'
    },
    leftAnchor: {
      position: 'absolute',
      left: 0,
      bottom: 0
    },
    rightAnchor: {
      position: 'absolute',
      right: 0,
      bottom: 0
    }
  };
})(Protractor);

exports["default"] = _default;
//# sourceMappingURL=index.js.map