interval.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3. var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
  4. var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
  5. var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
  6. var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
  7. function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (_isNativeReflectConstruct()) { 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); }; }
  8. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  9. var Geom = require('./base');
  10. var Util = require('../util/common');
  11. var SizeMixin = require('./mixin/size');
  12. require('./shape/interval');
  13. var Interval = /*#__PURE__*/function (_Geom) {
  14. (0, _inheritsLoose2["default"])(Interval, _Geom);
  15. var _super = _createSuper(Interval);
  16. var _proto = Interval.prototype;
  17. _proto.getDefaultCfg = function getDefaultCfg() {
  18. var cfg = _Geom.prototype.getDefaultCfg.call(this);
  19. cfg.type = 'interval';
  20. cfg.shapeType = 'interval';
  21. cfg.generatePoints = true;
  22. return cfg;
  23. };
  24. function Interval(cfg) {
  25. var _this;
  26. _this = _Geom.call(this, cfg) || this;
  27. Util.mix((0, _assertThisInitialized2["default"])(_this), SizeMixin);
  28. return _this;
  29. }
  30. _proto.init = function init() {
  31. _Geom.prototype.init.call(this); // 绑定事件
  32. this.initEvent();
  33. };
  34. _proto.createShapePointsCfg = function createShapePointsCfg(obj) {
  35. var cfg = _Geom.prototype.createShapePointsCfg.call(this, obj);
  36. cfg.size = this.getNormalizedSize(obj);
  37. return cfg;
  38. };
  39. _proto.clearInner = function clearInner() {
  40. _Geom.prototype.clearInner.call(this);
  41. this.set('defaultSize', null);
  42. };
  43. return Interval;
  44. }(Geom);
  45. Geom.Interval = Interval;
  46. module.exports = Interval;