"use strict";

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.tool = void 0;

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

var _component = _interopRequireDefault(require("./component"));

var _utils = require("../../utils");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

var tool = function tool() {
  return {
    type: 'circle',
    Component: _component["default"],
    hover: function hover(point, mark) {
      return _objectSpread(_objectSpread({}, mark), {}, {
        edge: point
      });
    },
    addPoint: function addPoint(point, mark) {
      if (mark && (0, _utils.equalPoints)(mark.root, point)) {
        return mark;
      }

      if (!mark) {
        return {
          type: 'circle',
          root: point,
          building: true
        };
      } else {
        return _objectSpread(_objectSpread({}, mark), {}, {
          edge: point,
          building: false
        });
      }
    }
  };
};

exports.tool = tool;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9jb2RlL2dyYXBoaW5nL3Rvb2xzL2NpcmNsZS9pbmRleC5qcyJdLCJuYW1lcyI6WyJ0b29sIiwidHlwZSIsIkNvbXBvbmVudCIsIkNpcmNsZSIsImhvdmVyIiwicG9pbnQiLCJtYXJrIiwiZWRnZSIsImFkZFBvaW50Iiwic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