From 00c2f8f8f336843dd4ae11123d4b168ac7eb7dcb Mon Sep 17 00:00:00 2001 From: Pierre Poupin Date: Sun, 19 Apr 2020 20:04:36 +0200 Subject: [PATCH] fix arrowLength=0 not working properly --- src/ArcherContainer.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ArcherContainer.js b/src/ArcherContainer.js index 2174249..e87c0f5 100644 --- a/src/ArcherContainer.js +++ b/src/ArcherContainer.js @@ -225,7 +225,11 @@ export class ArcherContainer extends React.Component { return this.getSourceToTargets().map(({ source, target, label, style }: SourceToTargetType) => { const strokeColor = (style && style.strokeColor) || this.props.strokeColor; - const arrowLength = (style && style.arrowLength) || this.props.arrowLength; + // Actual arrowLength value might be 0, which can't work with a simple 'actualValue || defaultValue' + let arrowLength = this.props.arrowLength; + if (style && (style.arrowLength || style.arrowLength === 0)) { + arrowLength = style.arrowLength; + } const strokeWidth = (style && style.strokeWidth) || this.props.strokeWidth; @@ -288,7 +292,11 @@ export class ArcherContainer extends React.Component { return this.getSourceToTargets().map(({ source, target, label, style }: SourceToTargetType) => { const strokeColor = (style && style.strokeColor) || this.props.strokeColor; - const arrowLength = (style && style.arrowLength) || this.props.arrowLength; + // Actual arrowLength value might be 0, which can't work with a simple 'actualValue || defaultValue' + let arrowLength = this.props.arrowLength; + if (style && (style.arrowLength || style.arrowLength === 0)) { + arrowLength = style.arrowLength; + } const arrowThickness = (style && style.arrowThickness) || this.props.arrowThickness;