Skip to content

Commit

Permalink
Merge pull request #90 from pierpo/fix/0-arrow-length
Browse files Browse the repository at this point in the history
fix arrowLength=0 not working properly
  • Loading branch information
pierpo authored Apr 19, 2020
2 parents 2b1d963 + 00c2f8f commit 8fe13b4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ArcherContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ export class ArcherContainer extends React.Component<Props, State> {
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;

Expand Down Expand Up @@ -288,7 +292,11 @@ export class ArcherContainer extends React.Component<Props, State> {
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;

Expand Down

0 comments on commit 8fe13b4

Please sign in to comment.