const Geom = require('./base');
const Util = require('../util/common');
const SizeMixin = require('./mixin/size');
require('./shape/interval');

class Interval extends Geom {
  getDefaultCfg() {
    const cfg = super.getDefaultCfg();
    cfg.type = 'interval';
    cfg.shapeType = 'interval';
    cfg.generatePoints = true;
    return cfg;
  }

  constructor(cfg) {
    super(cfg);
    Util.mix(this, SizeMixin);
  }

  init() {
    super.init();
    // 绑定事件
    this.initEvent();
  }

  createShapePointsCfg(obj) {
    const cfg = super.createShapePointsCfg(obj);
    cfg.size = this.getNormalizedSize(obj);
    return cfg;
  }

  clearInner() {
    super.clearInner();
    this.set('defaultSize', null);
  }
}

Geom.Interval = Interval;

module.exports = Interval;
