Skip to content

Commit 9c63d25

Browse files
authored
arrow accepts strokeWidth: 1 (#923)
closes #921
1 parent 72e8cb7 commit 9c63d25

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/marks/arrow.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {radians} from "../math.js";
33
import {Mark} from "../plot.js";
44
import {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform, offset} from "../style.js";
55
import {maybeSameValue} from "./link.js";
6+
import {constant} from "../options.js";
67

78
const defaults = {
89
ariaLabel: "arrow",
@@ -47,7 +48,7 @@ export class Arrow extends Mark {
4748
render(index, {x, y}, channels, dimensions) {
4849
const {x1: X1, y1: Y1, x2: X2 = X1, y2: Y2 = Y1, SW} = channels;
4950
const {dx, dy, strokeWidth, bend, headAngle, headLength, insetStart, insetEnd} = this;
50-
const sw = SW ? i => SW[i] : () => strokeWidth;
51+
const sw = SW ? i => SW[i] : constant(strokeWidth === undefined ? 1 : strokeWidth);
5152

5253
// When bending, the offset between the straight line between the two points
5354
// and the outgoing tangent from the start point. (Also the negative

test/output/markovChain.svg

Lines changed: 7 additions & 7 deletions
Loading

test/plots/markov-chain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default async function() {
1919
y2: ({j}) => centers[j][1],
2020
strokeOpacity: "value",
2121
bend: true,
22+
strokeWidth: 1,
2223
inset: 55
2324
}),
2425
Plot.text(centers, {text: ["A", "B", "C"], dy: 55}),

0 commit comments

Comments
 (0)