stroke.js 927 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.stroke = void 0;
  4. const x6_common_1 = require("@antv/x6-common");
  5. exports.stroke = {
  6. qualify: x6_common_1.ObjectExt.isPlainObject,
  7. set(stroke, { view }) {
  8. const cell = view.cell;
  9. const options = Object.assign({}, stroke);
  10. if (cell.isEdge() && options.type === 'linearGradient') {
  11. const edgeView = view;
  12. const source = edgeView.sourcePoint;
  13. const target = edgeView.targetPoint;
  14. options.id = `gradient-${options.type}-${cell.id}`;
  15. options.attrs = Object.assign(Object.assign({}, options.attrs), { x1: source.x, y1: source.y, x2: target.x, y2: target.y, gradientUnits: 'userSpaceOnUse' });
  16. view.graph.defs.remove(options.id);
  17. }
  18. return `url(#${view.graph.defineGradient(options)})`;
  19. },
  20. };
  21. //# sourceMappingURL=stroke.js.map