point.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  2. var Util = require('../../util/common');
  3. var GuideBase = require('./base');
  4. var Point =
  5. /*#__PURE__*/
  6. function (_GuideBase) {
  7. _inheritsLoose(Point, _GuideBase);
  8. function Point() {
  9. return _GuideBase.apply(this, arguments) || this;
  10. }
  11. var _proto = Point.prototype;
  12. _proto._initDefaultCfg = function _initDefaultCfg() {
  13. this.type = 'point';
  14. this.position = null;
  15. this.offsetX = 0;
  16. this.offsetY = 0;
  17. this.style = {
  18. fill: '#1890FF',
  19. r: 3,
  20. lineWidth: 1,
  21. stroke: '#fff'
  22. };
  23. };
  24. _proto.render = function render(coord, container) {
  25. var position = this.parsePoint(coord, this.position);
  26. if (!position) return null;
  27. var shape = container.addShape('Circle', {
  28. className: 'guide-point',
  29. attrs: Util.mix({
  30. x: position.x + this.offsetX,
  31. y: position.y + this.offsetY
  32. }, this.style)
  33. });
  34. this.element = shape;
  35. return shape;
  36. };
  37. return Point;
  38. }(GuideBase);
  39. GuideBase.Point = Point;
  40. module.exports = Point;