source: node_modules/victory-vendor/lib-vendor/d3-shape/src/link.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 2.1 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.link = link;
7exports.linkHorizontal = linkHorizontal;
8exports.linkRadial = linkRadial;
9exports.linkVertical = linkVertical;
10var _index = require("../../../lib-vendor/d3-path/src/index.js");
11var _array = require("./array.js");
12var _constant = _interopRequireDefault(require("./constant.js"));
13var _bump = require("./curve/bump.js");
14var _point = require("./point.js");
15function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16function linkSource(d) {
17 return d.source;
18}
19function linkTarget(d) {
20 return d.target;
21}
22function link(curve) {
23 let source = linkSource;
24 let target = linkTarget;
25 let x = _point.x;
26 let y = _point.y;
27 let context = null;
28 let output = null;
29 function link() {
30 let buffer;
31 const argv = _array.slice.call(arguments);
32 const s = source.apply(this, argv);
33 const t = target.apply(this, argv);
34 if (context == null) output = curve(buffer = (0, _index.path)());
35 output.lineStart();
36 argv[0] = s, output.point(+x.apply(this, argv), +y.apply(this, argv));
37 argv[0] = t, output.point(+x.apply(this, argv), +y.apply(this, argv));
38 output.lineEnd();
39 if (buffer) return output = null, buffer + "" || null;
40 }
41 link.source = function (_) {
42 return arguments.length ? (source = _, link) : source;
43 };
44 link.target = function (_) {
45 return arguments.length ? (target = _, link) : target;
46 };
47 link.x = function (_) {
48 return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constant.default)(+_), link) : x;
49 };
50 link.y = function (_) {
51 return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constant.default)(+_), link) : y;
52 };
53 link.context = function (_) {
54 return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), link) : context;
55 };
56 return link;
57}
58function linkHorizontal() {
59 return link(_bump.bumpX);
60}
61function linkVertical() {
62 return link(_bump.bumpY);
63}
64function linkRadial() {
65 const l = link(_bump.bumpRadial);
66 l.angle = l.x, delete l.x;
67 l.radius = l.y, delete l.y;
68 return l;
69}
Note: See TracBrowser for help on using the repository browser.