"use strict";

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

var _color = require("../../utils/color");

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var defaultColor = (0, _color.colorToHexNumber)('#00C4CC');
/**
 * 选择框
 *
 * @export
 * @class SelectorModel
 * @extends {baseAdapter}
 * @implements {ISelector}
 */

var SelectorModel = function SelectorModel(props) {
  _classCallCheck(this, SelectorModel);

  _defineProperty(this, "x", 0);

  _defineProperty(this, "y", 0);

  _defineProperty(this, "width", 0);

  _defineProperty(this, "height", 0);

  _defineProperty(this, "fill", defaultColor);

  _defineProperty(this, "fillAlpha", 0.15);

  _defineProperty(this, "lineColor", defaultColor);

  _defineProperty(this, "lineWidth", 1);

  Object.assign(this, {
    x: props.left,
    y: props.top,
    width: props.width,
    height: props.height,
    visible: !props.hidden
  });

  if (props.backgroundColor) {
    this.fill = (0, _color.colorToHexNumber)(props.backgroundColor);
  }

  if (props.borderColor) {
    this.lineColor = (0, _color.colorToHexNumber)(props.borderColor);
  }

  if (props.borderWidth) {
    this.lineWidth = props.borderWidth;
  }

  if (props.opacity) {
    this.fillAlpha = props.opacity;
  }

  return this;
};

exports.default = SelectorModel;