Skip to content

Commit

Permalink
Merge pull request #271 from sto3psl/text-em
Browse files Browse the repository at this point in the history
fix: tickLabelProps dy and dx work again
  • Loading branch information
hshoff authored Apr 19, 2018
2 parents 6c97c49 + 95186b1 commit 772ccea
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions packages/vx-text/src/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class Text extends Component {
} = this.props;
const { wordsByLines } = this.state;

const x = textProps.x + dx;
const y = textProps.y + dy;
const x = textProps.x;
const y = textProps.y;

let startDy;
switch (verticalAnchor) {
Expand Down Expand Up @@ -138,22 +138,22 @@ class Text extends Component {
}

return (
<text
x={x}
y={y}
textAnchor={textAnchor}
{...textProps}
>
{
wordsByLines.map((line, index) => (
<tspan x={x} dy={index === 0 ? startDy : lineHeight} key={index}>
{line.words.join(' ')}
</tspan>
))
}
</text>
<svg x={dx} y={dy} fontSize={textProps.fontSize} style={{ overflow: 'visible' }}>
<text
{...textProps}
textAnchor={textAnchor}
>
{
wordsByLines.map((line, index) => (
<tspan x={x} dy={index === 0 ? startDy : lineHeight} key={index}>
{line.words.join(' ')}
</tspan>
))
}
</text>
</svg>
);
}
}

export default Text;
export default Text;

0 comments on commit 772ccea

Please sign in to comment.