"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.registerLines = void 0;
var _g = _interopRequireDefault(require("@antv/g6"));
var registerLines = exports.registerLines = function registerLines() {
  _g["default"].registerEdge('flow-line', {
    drawShape: function drawShape(cfg, group) {
      var startPoint = cfg.startPoint;
      var endPoint = cfg.endPoint;
      var style = cfg.style;
      var shape = group.addShape('path', {
        attrs: {
          stroke: style.stroke,
          path: [['M', startPoint.x, startPoint.y], ['L', startPoint.x, (startPoint.y + endPoint.y) / 2], ['L', endPoint.x, (startPoint.y + endPoint.y) / 2], ['L', endPoint.x, endPoint.y]]
        }
      });
      if (cfg.label && cfg.label.length) {
        // the left label
        group.addShape('text', {
          attrs: {
            text: cfg.label,
            fill: '#595959',
            textAlign: 'center',
            textBaseline: 'middle',
            x: endPoint.x,
            y: startPoint.x === endPoint.x ? (startPoint.y + endPoint.y) / 2 : (startPoint.y + endPoint.y) / 2 + (endPoint.y - startPoint.y) / 8
          },
          name: 'text'
        });
      }
      return shape;
    }
  });
};