Skip to content

Commit b23eafd

Browse files
committed
strokeWidth as a channel (rebased)
1 parent 1077eef commit b23eafd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/marks/link.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class Link extends Mark {
1717
fillOpacity,
1818
stroke,
1919
strokeOpacity,
20+
strokeWidth,
2021
curve,
2122
...options
2223
} = {}
@@ -25,6 +26,7 @@ export class Link extends Mark {
2526
const [vfillOpacity, cfillOpacity] = maybeNumber(fillOpacity);
2627
const [vstroke, cstroke] = maybeColor(stroke, "currentColor");
2728
const [vstrokeOpacity, cstrokeOpacity] = maybeNumber(strokeOpacity);
29+
const [vstrokeWidth, cstrokeWidth] = maybeNumber(strokeWidth, 1);
2830
super(
2931
data,
3032
[
@@ -36,7 +38,8 @@ export class Link extends Mark {
3638
{name: "fill", value: vfill, scale: "color", optional: true},
3739
{name: "fillOpacity", value: vfillOpacity, scale: "opacity", optional: true},
3840
{name: "stroke", value: vstroke, scale: "color", optional: true},
39-
{name: "strokeOpacity", value: vstrokeOpacity, scale: "opacity", optional: true}
41+
{name: "strokeOpacity", value: vstrokeOpacity, scale: "opacity", optional: true},
42+
{name: "strokeWidth", value: vstrokeWidth, optional: true}
4043
],
4144
options
4245
);
@@ -47,13 +50,14 @@ export class Link extends Mark {
4750
stroke: cstroke,
4851
strokeMiterlimit: cstroke === "none" ? undefined : 1,
4952
strokeOpacity: cstrokeOpacity,
53+
strokeWidth: cstrokeWidth,
5054
...options
5155
});
5256
}
5357
render(
5458
I,
5559
{x, y},
56-
{x1: X1, y1: Y1, x2: X2, y2: Y2, title: L, stroke: S, strokeOpacity: SO}
60+
{x1: X1, y1: Y1, x2: X2, y2: Y2, title: L, stroke: S, strokeOpacity: SO, strokeWidth: SW}
5761
) {
5862
const index = filter(I, X1, Y1, X2, Y2, S, SO);
5963
return create("svg:g")
@@ -74,6 +78,7 @@ export class Link extends Mark {
7478
})
7579
.call(applyAttr, "stroke", S && (i => S[i]))
7680
.call(applyAttr, "stroke-opacity", SO && (i => SO[i]))
81+
.call(applyAttr, "stroke-width", SW && (i => SW[i]))
7782
.call(title(L)))
7883
.node();
7984
}

0 commit comments

Comments
 (0)