base.js 909 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. var Util = require('../util/common');
  2. var Base =
  3. /*#__PURE__*/
  4. function () {
  5. var _proto = Base.prototype;
  6. _proto._initDefaultCfg = function _initDefaultCfg() {};
  7. function Base(cfg) {
  8. this._initDefaultCfg();
  9. Util.mix(this, cfg);
  10. var start;
  11. var end;
  12. if (this.plot) {
  13. start = this.plot.bl;
  14. end = this.plot.tr;
  15. this.start = start;
  16. this.end = end;
  17. } else {
  18. start = this.start;
  19. end = this.end;
  20. }
  21. this.init(start, end);
  22. }
  23. _proto.init = function init() {};
  24. _proto.convertPoint = function convertPoint(point) {
  25. return point;
  26. };
  27. _proto.invertPoint = function invertPoint(point) {
  28. return point;
  29. };
  30. _proto.reset = function reset(plot) {
  31. this.plot = plot;
  32. var bl = plot.bl,
  33. tr = plot.tr;
  34. this.start = bl;
  35. this.end = tr;
  36. this.init(bl, tr);
  37. };
  38. return Base;
  39. }();
  40. module.exports = Base;